/*
	Copyright (c) 2010 Canadensys
*/
package net.canadensys.dataportal.vascan;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;

import net.canadensys.dataportal.scientificname.ScientificNameStructure;
import net.canadensys.dataportal.scientificname.TaxonRankEnum;
import net.canadensys.dataportal.utils.FullScientificNameGenerator;
import net.canadensys.dataportal.utils.HibernateUtil;
import net.canadensys.dataportal.vascan.config.ApplicationConfig;
import net.canadensys.dataportal.vascan.config.impl.InstallationConfig;
import net.canadensys.dataportal.vascan.utils.LabelMappings;

import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

@SuppressWarnings("unchecked")
public final class TaxonManager {

	/**
	 * 
	 * @param selectedTaxonId
	 * @return
	 */
	public static final Vector<HashMap<String,Object>> getChecklistTaxons(int selectedTaxonId){
		Vector<HashMap<String,Object>> results = new Vector<HashMap<String,Object>>();
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT taxon.id, lookup.calname, lookup.rank FROM taxon,lookup WHERE taxon.id = lookup.taxonid AND taxon.rankid <= " + ApplicationConfig.RANK_GENUS + " AND taxon.statusid = " + ApplicationConfig.STATUS_ACCEPTED + "  ORDER BY lookup.calname ASC")
		.addScalar("id",Hibernate.INTEGER)
		.addScalar("calname",Hibernate.STRING)
		.addScalar("rank",Hibernate.STRING);
		List<Object[]> taxons = (List<Object[]>)query.list();
		if(taxons != null){
			for(Object[] taxon : taxons){
				int id = (Integer)taxon[0];
				String calname = (String)taxon[1];
				String rank = (String)taxon[2];
				String selected = "";
				HashMap<String,Object> t = new HashMap<String,Object>();
				
				if(id == selectedTaxonId)
					selected = "selected=\"selected\"";
				t.put("selected", selected);
				t.put("id",id);
				t.put("calname", calname);
				t.put("rank", rank);
				results.add(t);
			}
		}
		return results;
	}
	
	/**
	 * 
	 * @param relatedid
	 * @param array
	 * @param recursive
	 */
	private static final void getChildren(Integer id, ArrayList<Integer> array, boolean recursive){
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT taxonomy.childid FROM taxonomy, taxon, rank WHERE taxonomy.childid = taxon.id AND taxonomy.parentid = :id AND taxon.rankid = rank.id ORDER BY rank.sort ASC");
		query.setParameter("id", id);
		List<Integer> acceptedIds = query.list();
		for(Integer acceptedId : acceptedIds){
			if(!array.contains(acceptedId))
				array.add(acceptedId);
			if(recursive)
				getChildren(acceptedId,array,recursive);
		}
	}
	
	/**
	 * 
	 * @param taxonid
	 * @param map
	 * @return
	 */
	private static final HashMap<Object,Integer> getDistribution(Integer id, HashMap<Object,Integer> map, HashMap<Object,Integer> habitusMap){
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT regionid, distributionstatusid FROM distribution WHERE distribution.taxonid =:id").addScalar("regionid",Hibernate.INTEGER).addScalar("distributionstatusid",Hibernate.INTEGER);
		query.setParameter("id",id);
		
		List<Object[]> distributions = query.list();
		for(Object[] distribution : distributions){
			int regionid = (Integer)distribution[0];
			int statusid = (Integer)distribution[1];
			if(map.containsKey(regionid)){
				if(map.get(regionid) > statusid)
					map.put(regionid,statusid);
			}
			else{
				map.put(regionid,statusid);
			}
		}
		
		query = hibernateSession.createSQLQuery("SELECT habit FROM habit,taxonhabit WHERE habit.id = taxonhabit.habitid AND taxonhabit.taxonid =:id")
		.addScalar("habit",Hibernate.STRING);
		query.setParameter("id",id);
		List<String> habituses = query.list();
		for(String habitus : habituses){
			if(habitusMap.containsKey(habitus)){
				int habituscount = (Integer)habitusMap.get(habitus);
				habituscount++;
				habitusMap.put((Object)habitus,habituscount);
			}
			else{
				habitusMap.put((Object)habitus,1);
			}
		}
		
		//Set<Integer> array = new HashSet<Integer>();
		ArrayList<Integer> array = new ArrayList<Integer>();
		getChildren(id,array,false);
		for(Integer parentid : array){
			map = getDistribution(parentid,map,habitusMap);
		}
		return map;
	}
	
	/**
	 * 
	 * @param taxonid
	 * @return
	 */
	private static final List<Integer> getHabit(Integer id){
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT id FROM taxonhabit WHERE taxonhabit.taxonid =:id").addScalar("id",Hibernate.INTEGER);
		query.setParameter("id", id);
		List<Integer> habitus = (List<Integer>) query.list();
		return habitus;
	}
	
	private static final int getStatus(Integer id){
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT statusid FROM taxon WHERE taxon.id =:id")
		.addScalar("statusid",Hibernate.INTEGER);
		query.setParameter("id", id);
		int rankid = (Integer) query.uniqueResult();
		return rankid;
	}
	
	
	public static final boolean isLeaf(Integer id){
		boolean isLeaf = true;
		int count = 0;
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT count(childid) as childid FROM taxonomy, taxon WHERE taxon.id = taxonomy.childid AND taxon.statusid = :statusid AND taxonomy.parentid = :id")
		.addScalar("childid",Hibernate.INTEGER);
		query.setParameter("id", id);
		query.setParameter("statusid", ApplicationConfig.STATUS_ACCEPTED);
		count = (Integer) query.uniqueResult();
		if(count > 0)
			isLeaf = false;
		return isLeaf;
	}
	
	/**
	 * The lookup table must be empty.
	 * This function will not commit
	 * @param taxon
	 * @param hibernateSession
	 * @throws HibernateException
	 * @throws SQLException
	 */
	public static final void generateLookup(Taxon taxon, org.hibernate.Session hibernateSession)
		throws HibernateException, SQLException{		
		// get children (ids, not taxon objects) of taxon parent
		//Set<Integer> array = new HashSet<Integer>();
		ArrayList<Integer> array = new ArrayList<Integer>();
		array.add(taxon.getId());
		getChildren(taxon.getId(),array,true);
		
		//SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
		//Calendar date = Calendar.getInstance();
		java.util.Date date = new java.util.Date();
		java.sql.Date sqlDate = new java.sql.Date(date.getTime());

		// for each child, get habitus info, rank, generate full scientific name with html no author, and province distribution.
		String sql = "INSERT INTO lookup (calname,calnameauthor,calnamehtml,calnamehtmlauthor,taxonid,isleaf,status,rank," +
				"calhabit,AB,BC,GL,NL_L,MB,NB,NL_N,NT,NS,NU,`ON`,PE,QC,PM,SK,YT,higherclassification,`class`,`order`,`family`" +
				",genus,subgenus,specificepithet,infraspecificepithet,author,cdate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		
		PreparedStatement insert = null;
		insert = hibernateSession.connection().prepareStatement(sql);
		ScientificNameStructure snStructure;
	
		TreeMap<TaxonRankEnum,String> classificationMap = new TreeMap<TaxonRankEnum, String>();
		
		for(Integer childId : array){
			
			snStructure = loadScientificNameStructure(childId);
			String author = snStructure.getAuthor();
			String rank = snStructure.getRank();
			
			String calname = 
					FullScientificNameGenerator.encode(snStructure,author,false,false);
			String calnameauthor = 
					FullScientificNameGenerator.encode(snStructure,author,true,false);
			String calnamehtml = 
					FullScientificNameGenerator.encode(snStructure,author,false,true);
			String calnamehtmlauthor = 
					FullScientificNameGenerator.encode(snStructure,author,true,true);
			
			String status = LabelMappings.getStatusLabel(getStatus(childId));
			
			String higherClassification = "";
			boolean isleaf = true;
			
			String specificEpithet = generateSpecificEpithet(snStructure);
			String infraSpecificEpithet = generateInfraspecificEpithet(snStructure);
			
			StringBuffer habitus = new StringBuffer("");
			HashMap<Object,Integer> map = new HashMap<Object,Integer>();
			HashMap<Object,Integer> habitusMap = new HashMap<Object,Integer>();
			HashMap<Integer,Integer> distribution = new HashMap<Integer,Integer>();
			for(int j = 1; j <= 16; j++){
				distribution.put(j,0);
			}
					
			if(status.equals(ApplicationConfig.LABEL_STATUS_ACCEPTED)){
				isleaf = isLeaf(childId);
				
				//load parent names into a map
				getHigherClassificationNames(childId, snStructure.getRankEnum(), classificationMap);

				//compute higherClassification
				higherClassification = StringUtils.join(classificationMap.values(),";");

				//add the taxon rank to the map after higherClassification generation
				classificationMap.put(snStructure.getRankEnum(), calname);
				
				map = getDistribution(childId,map,habitusMap);
				if(map != null){
					for(int i = 1; i <= 16; i++){
						if(map.containsKey(i))
							distribution.put(i, map.get(i));
					}
				}

				if(habitusMap != null){
					// sort habitusMap based on values
					//TreeMap<Object, Integer> tMap  = new TreeMap<Object, Integer>(new ValueComparator(habitusMap));
					TreeSet tSet  = new TreeSet(new Comparator() {
			            public int compare(Object obj, Object obj1) {
			            	//descending sort...
			                //return ((Comparable) ((Map.Entry) obj).getValue()).compareTo(((Map.Entry) obj1).getValue());

			            	// 1,-1,1 are the proper values to return in our case...
			            	if( (Integer)((Map.Entry)obj).getValue() < (Integer)((Map.Entry)obj1).getValue())
			            			return 1;
			            	else if( (Integer)((Map.Entry)obj).getValue() > (Integer)((Map.Entry)obj1).getValue())
			            		return -1;
			            	else
			            		return 1;
			            }
			        });
					
					// fill tSet with order map entries based on comparator method
					Iterator habitusIterator = habitusMap.entrySet().iterator();
					while(habitusIterator.hasNext()){
						Map.Entry e = (Map.Entry)habitusIterator.next();
						tSet.add(e);
					}
					// for every ordered entry, append into a comma separated string
					Iterator it = tSet.iterator();
					while(it.hasNext()){
						Entry e = (Entry) it.next();
						habitus.append(e.getKey());
						if(it.hasNext())
							habitus.append(",");
					}
				}
			}
			else if(status.equals(ApplicationConfig.LABEL_STATUS_SYNONYM)){
				//in case of synonym, we use the uninomial as genus
				classificationMap.put(TaxonRankEnum.GENUS, snStructure.getUninomial());
			}
			
			insert.setString(1, calname);
			insert.setString(2, calnameauthor);
			insert.setString(3, calnamehtml);
			insert.setString(4, calnamehtmlauthor);
			insert.setInt(5,childId);
			insert.setBoolean(6,isleaf);
			insert.setString(7,status);
			insert.setString(8,rank);
			insert.setString(9,habitus.toString());
			insert.setString(10,LabelMappings.getDistributionLabel(distribution.get(1)));
			insert.setString(11,LabelMappings.getDistributionLabel(distribution.get(2)));
			insert.setString(12,LabelMappings.getDistributionLabel(distribution.get(3)));
			insert.setString(13,LabelMappings.getDistributionLabel(distribution.get(4)));
			insert.setString(14,LabelMappings.getDistributionLabel(distribution.get(5)));
			insert.setString(15,LabelMappings.getDistributionLabel(distribution.get(6)));
			insert.setString(16,LabelMappings.getDistributionLabel(distribution.get(7)));
			insert.setString(17,LabelMappings.getDistributionLabel(distribution.get(8)));
			insert.setString(18,LabelMappings.getDistributionLabel(distribution.get(9)));
			insert.setString(19,LabelMappings.getDistributionLabel(distribution.get(10)));
			insert.setString(20,LabelMappings.getDistributionLabel(distribution.get(11)));
			insert.setString(21,LabelMappings.getDistributionLabel(distribution.get(12)));
			insert.setString(22,LabelMappings.getDistributionLabel(distribution.get(13)));
			insert.setString(23,LabelMappings.getDistributionLabel(distribution.get(14)));
			insert.setString(24,LabelMappings.getDistributionLabel(distribution.get(15)));
			insert.setString(25,LabelMappings.getDistributionLabel(distribution.get(16)));
			insert.setString(26, higherClassification);
			insert.setString(27, StringUtils.defaultString(classificationMap.get(TaxonRankEnum.CLASS)));
			insert.setString(28, StringUtils.defaultString(classificationMap.get(TaxonRankEnum.ORDER)));
			insert.setString(29, StringUtils.defaultString(classificationMap.get(TaxonRankEnum.FAMILY)));
			insert.setString(30, StringUtils.defaultString(classificationMap.get(TaxonRankEnum.GENUS)));
			insert.setString(31, StringUtils.defaultString(classificationMap.get(TaxonRankEnum.SUBGENUS)));
			insert.setString(32, specificEpithet);
			insert.setString(33, infraSpecificEpithet);
			insert.setString(34, author);
			insert.setDate(35, sqlDate);

			insert.execute();
			
			//we reuse the map so, clear it
			classificationMap.clear();
		}
		insert.close();
		array.clear();
		
		//Add the accepted vernacular names by update
		sql = "UPDATE lookup SET vernacularfr = (SELECT name FROM vernacularname WHERE taxonid=lookup.taxonid AND language=? AND statusid=?)";
		SQLQuery sQuery = hibernateSession.createSQLQuery(sql);
		sQuery.setString(0, ApplicationConfig.LANGUAGE_FR);
		sQuery.setInteger(1, ApplicationConfig.STATUS_ACCEPTED);
		sQuery.executeUpdate();
		
		sql = "UPDATE lookup SET vernacularen = (SELECT name FROM vernacularname WHERE taxonid=lookup.taxonid AND language=? AND statusid=?)";
		sQuery = hibernateSession.createSQLQuery(sql);
		sQuery.setString(0, ApplicationConfig.LANGUAGE_EN);
		sQuery.setInteger(1, ApplicationConfig.STATUS_ACCEPTED);
		sQuery.executeUpdate();
	}
	
	public static String getParentFSNByRankId(int taxonId, int rankId){
		String fsn = "";		
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT lookup.calname, lookup.rank, taxonomy.parentid" +
		" FROM lookup, taxonomy" +
		" WHERE taxonomy.childid =:taxonid" +
		" AND lookup.taxonid = taxonomy.parentid" +
		" AND lookup.status = '" + ApplicationConfig.LABEL_STATUS_ACCEPTED + "'")
		.addScalar("calname",Hibernate.STRING)
		.addScalar("rank",Hibernate.STRING)
		.addScalar("parentid",Hibernate.INTEGER);
		query.setParameter("taxonid", taxonId);
		Object[] parent = null;
		try{
			parent = (Object[]) query.uniqueResult();
			if(parent != null){
				if(LabelMappings.getRankId((String)parent[1]) == rankId)
					fsn = (String)parent[0];
				else
					fsn = getParentFSNByRankId((Integer)parent[2],rankId);
			}
		}
		catch (HibernateException e) {
			System.out.println(query + "taxonID : " +taxonId);
			throw e;
		}
		return fsn;
	}
	
	public static ArrayList<Taxon> recursiveClassificationChild(Taxon taxon, ArrayList<Taxon> list, int rank){
		List<Taxon> children = taxon.getChildren();
		//Set<Taxon> children  = taxon.getChildren();
		for(Taxon child : children){
			if(child.getStatus().getId() == ApplicationConfig.STATUS_ACCEPTED && child.getRank().getId() <= rank){
				list.add(child);
				recursiveClassificationChild(child,list,rank);
			}
		}
		return list;
	}
	
	
	public static ArrayList<Taxon> recursiveClassificationParent(Taxon taxon, ArrayList<Taxon> list){
		List<Taxon> parents = taxon.getParents();
		for(Taxon parent : parents){
			if(parent.getStatus().getId() == ApplicationConfig.STATUS_ACCEPTED){
				list.add(0,parent);
				recursiveClassificationParent(parent,list);
			}
		}
		return list;
	}
	

	public static String getAuthor(Integer taxonId){
		String author= "";
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		Query query = hibernateSession.createSQLQuery("SELECT author FROM taxon WHERE id =:taxonId")
		.addScalar("author",Hibernate.STRING);
		query.setParameter("taxonId", taxonId);
		Object obj = (Object) query.uniqueResult();
		if(obj != null)
			author = (String)obj;
		return author;
	}
	
	public static List<Taxon> getClassification(Taxon taxon){
		int lowerRank = 0;
		int rank = taxon.getRank().getId();
		if(rank >= ApplicationConfig.RANK_CLASS && rank < ApplicationConfig.RANK_ORDER){
			lowerRank = ApplicationConfig.RANK_ORDER;
		}
		else if(rank >= ApplicationConfig.RANK_ORDER && rank < ApplicationConfig.RANK_FAMILY){
			lowerRank = ApplicationConfig.RANK_FAMILY;
		}
		else if(rank >= ApplicationConfig.RANK_FAMILY && rank < ApplicationConfig.RANK_GENUS){
			lowerRank = ApplicationConfig.RANK_GENUS;
		}
		else if(rank >= ApplicationConfig.RANK_GENUS && rank < ApplicationConfig.RANK_SPECIES){
			lowerRank = ApplicationConfig.RANK_SPECIES;
		}
		else if(rank >= ApplicationConfig.RANK_SPECIES && rank < ApplicationConfig.RANK_VARIETY)
			lowerRank = ApplicationConfig.RANK_VARIETY;
		
		ArrayList<Taxon> classification = new ArrayList();
		recursiveClassificationParent(taxon,classification);
		classification.add(taxon);
		if(lowerRank != 0)
			recursiveClassificationChild(taxon,classification,lowerRank);
		return classification;
	}
	
	/**
	 * Generates the specific epithet.
	 * rule: available for rank species, subspecies and variety
	 * value: binomial
	 * @param snStructure
	 * @return the specificEpithet or an empty string if not available
	 */
	private static String generateSpecificEpithet(ScientificNameStructure snStructure){
		int currentRank = -1;
		if(snStructure.getRankId() != null){
			currentRank = snStructure.getRankId().intValue();
		}
		
		if(ApplicationConfig.RANK_SPECIES == currentRank || 
		   ApplicationConfig.RANK_SUBSPECIES == currentRank ||
		   ApplicationConfig.RANK_VARIETY == currentRank){
			return snStructure.getBinomial();
		}
		return "";
	}
	
	/**
	 * Generates the infraspecific epithet.
	 * rule: available for ranks subspecies and variety
	 * value: if quadrinomial { quadrinomial } else { trinomial }
	 * @param snStructure
	 * @return the specificEpithet or an empty string if not available
	 */
	private static String generateInfraspecificEpithet(ScientificNameStructure snStructure){
		int currentRank = -1;
		if(snStructure.getRankId() != null){
			currentRank = snStructure.getRankId().intValue();
		}
		
		if(ApplicationConfig.RANK_SUBSPECIES == currentRank ||
		   ApplicationConfig.RANK_VARIETY == currentRank){
			if(snStructure.getQuadrinomial() != null && 
				!snStructure.getQuadrinomial().trim().equals("")){
				return snStructure.getQuadrinomial();
			}
			return snStructure.getTrinomial();
		}
		return "";
	}
	
	public static void writeDistributionSvg(Taxon taxon){
		File file = new File(InstallationConfig.getInstance().get(InstallationConfig.GENERATED_IMAGES_DIR_KEY) + ApplicationConfig.SVG_FILE_PREFIX + taxon.getId() + ApplicationConfig.SVG_FILE_EXT);
		//if(!file.exists()){
			try {
				List<Distribution> distribution = taxon.getDistribution();
				Lookup lookup = taxon.getLookup();
				PrintWriter pw = new PrintWriter(file);
				
				String AB = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String BC = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String GL = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String MB = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String NB = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String NLN = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String NLL = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String NT = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String NS = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String NU = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String ON = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String PE = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String QC = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String PM = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String SK = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				String YT = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
				
				if(distribution != null && distribution.size() > 0){
					for(Distribution dist : distribution){
						String distributionStatus = dist.getDistributionStatus().getDistributionstatus().toLowerCase();	
		            	switch(dist.getRegion().getId()){
		            		case ApplicationConfig.PROVINCE_AB : AB = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_BC : BC = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_GL : GL = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_MB : MB = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_NB : NB = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_NLN : NLN = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_NLL : NLL = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_NT : NT = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_NS : NS = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_NU : NU = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_ON : ON = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_PE : PE = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_QC : QC = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_PM : PM = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_SK : SK = getDistributionColor(distributionStatus); break;
		            		case ApplicationConfig.PROVINCE_YT : YT = getDistributionColor(distributionStatus); break;	
		            	}
		            }
				}
				else if(lookup != null){
		            AB = getDistributionColor(lookup.getAB());
	        		BC = getDistributionColor(lookup.getBC());
	        		GL = getDistributionColor(lookup.getGL());
	        		MB = getDistributionColor(lookup.getMB());
	        		NB = getDistributionColor(lookup.getNB());
	        		NLL = getDistributionColor(lookup.getNL_L());
	        		NLN = getDistributionColor(lookup.getNL_N());
	        		NT = getDistributionColor(lookup.getNT());
	        		NS = getDistributionColor(lookup.getNS());
	        		NU = getDistributionColor(lookup.getNU());
	        		ON = getDistributionColor(lookup.getON());
	        		PE = getDistributionColor(lookup.getPE());
	        		QC = getDistributionColor(lookup.getQC());
	        		PM = getDistributionColor(lookup.getPM());
	        		SK = getDistributionColor(lookup.getSK());
	        		YT = getDistributionColor(lookup.getYT());	
				}
				
				pw.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
				pw.write("<!-- Created with Inkscape (http://www.inkscape.org/) and manually edited for www.canadensys.net -->\n");
				pw.write("<!-- Based on http://commons.wikimedia.org/wiki/File:Canada_blank_map.svg -->\n");
				pw.write("<!-- Projection of the map : Lambert conformal -->\n");
				pw.write("<svg xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" style=\"background:#ffffff\">\n");
				pw.write("<!-- Width & height originally 1100pt, white background necessary for printing -->\n");
				pw.write("<g id=\"map\" transform=\"scale(0.30)\">\n");
				pw.write("<g id=\"Canada\" style=\"fill:#d3d3d3;\" transform=\"translate(-940,85)\">\n");
				pw.write("<g id=\"PM\" style=\"stroke:#d3d3d3;stroke-width:4\" transform=\"translate(964.53565,-4.6353197)\">\n");
				pw.write("<path id=\"PMisland\" style=\"stroke:none;fill:" + PM + ";\" d=\"M 1234.0193,1010.8876 C 1234.2419,1016.2534 1226.7267,1013.3034 1228.5536,1008.8425 C 1227.7937,1005.4059 1232.8951,1001.5102 1233.486,1006.7087 C 1233.7693,1008.0862 1233.908,1009.4876 1234.0193,1010.8876 z\" />\n");
				pw.write("<path id=\"PMcircle\" style=\"fill:" + PM + ";\" d=\"M 1265.9775,1064.9738 C 1266.2836,1074.1081 1258.3069,1082.7847 1249.0652,1082.7475 C 1240.5174,1082.988 1232.6256,1075.8842 1231.7097,1067.4249 C 1230.4648,1058.9417 1236.0734,1049.7973 1244.5354,1047.7366 C 1252.503,1045.5827 1261.6447,1050.1845 1264.5699,1057.9273 C 1265.5,1060.1516 1265.9852,1062.5625 1265.9775,1064.9738 z\" />\n");
				pw.write("<path id=\"PMline\" d=\"M 1243.234,1049.1713 C 1239.4312,1036.8238 1235.6283,1024.4764 1231.8254,1012.129\" />\n");
				pw.write("</g>\n");
				pw.write("<g id=\"GL\" style=\"fill:" + GL + ";\" transform=\"matrix(0.2806012,-0.2499947,0.2499947,0.2806012,690.2994,134.42262)\">\n");
				pw.write("<path id=\"GL1\" d=\"M 2857.3049,2638.1702 C 2855.4198,2602.1963 2861.5034,2560.1245 2836.661,2531.134 C 2839.7405,2504.8197 2868.0226,2475.5699 2835.3754,2453.6741 C 2828.1376,2432.8627 2892.6803,2396.6156 2844.112,2388.9736 C 2822.9162,2389.7633 2812.001,2373.0397 2826.3692,2357.5234 C 2823.9806,2330.0722 2810.4661,2305.2336 2792.5074,2285.2334 C 2777.9532,2269.4074 2710.7369,2262.8908 2753.8372,2241.8008 C 2772.4741,2230.118 2809.9683,2229.2142 2791.1805,2198.9938 C 2778.2559,2153.0657 2738.9223,2121.2191 2724.2268,2075.9343 C 2711.2403,2041.2769 2711.9747,2003.1443 2707.2553,1966.7063 C 2729.3248,1936.3469 2690.7882,1900.8208 2712.2572,1869.8255 C 2724.4876,1846.6183 2723.3692,1820.8454 2717.1781,1796.2117 C 2707.2558,1759.9777 2652.6618,1784.1044 2642.8846,1811.511 C 2642.7062,1835.38 2624.9541,1828.7943 2617.7212,1814.1447 C 2604.0453,1809.11 2564.8123,1812.0318 2592.4393,1792.5671 C 2624.7289,1773.8548 2598.9502,1727.588 2565.8574,1731.939 C 2534.5984,1734.5258 2526.2106,1692.1027 2493.4607,1700.6882 C 2464.8401,1707.9554 2427.5554,1699.0283 2407.9764,1726.6661 C 2410.486,1746.3001 2407.2989,1765.0341 2382.3463,1754.7408 C 2346.0737,1747.8268 2349.5399,1805.6483 2313.1449,1804.6257 C 2292.2626,1810.6333 2270.6162,1824.8564 2246.4171,1815.7158 C 2214.2004,1824.0235 2160.9389,1828.1113 2157.6296,1868.7827 C 2141.4768,1895.1864 2103.2416,1894.1732 2078.7131,1911.2194 C 2047.7809,1936.0978 2109.2385,1987.164 2062.4945,2004.9615 C 2027.0902,2019.1569 1987.4864,2017.5546 1951.4309,2029.1848 C 1921.085,2045.403 1958.3814,2073.7024 1962.3787,2094.864 C 1957.0101,2118.1646 1982.2395,2142.3395 1974.4724,2159.3461 C 1958.7503,2171.2397 1904.2606,2173.5788 1932.813,2202.5008 C 1923.0529,2227.1365 1917.9291,2278.6508 1959.1267,2270.1835 C 1988.4335,2263.3987 2017.4219,2273.5139 2039.6903,2292.9139 C 2080.4468,2321.812 2092.9077,2373.4776 2103.2799,2419.4889 C 2112.4636,2476.7603 2108.4057,2535.2472 2104.9737,2592.8185 C 2096.3771,2629.7875 2082.597,2665.5119 2079.6135,2703.6809 C 2069.142,2734.4126 2092.9713,2756.7795 2119.7628,2734.7495 C 2153.2172,2722.3357 2146.9185,2768.1375 2160.0582,2786.1313 C 2166.1378,2798.8791 2177.2483,2817.7652 2158.1566,2799.483 C 2148.7517,2782.6245 2090.4937,2765.0962 2105.2683,2797.3243 C 2126.1011,2827.0624 2168.7039,2839.2829 2177.6013,2877.1217 C 2173.7061,2907.0367 2166.8868,2937.3197 2164.268,2967.9352 C 2152.8316,2994.1143 2111.1299,2952.5096 2102.5252,2988.4381 C 2087.859,3017.0911 2071.7586,3045.4435 2060.9337,3075.7288 C 2065.5671,3103.4152 2062.8152,3130.3508 2058.4659,3157.7737 C 2060.3844,3192.0934 2059.3367,3227.099 2075.9082,3258.2376 C 2079.6891,3286.9408 2070.0145,3326.5048 2081.6351,3348.9418 C 2106.8264,3354.7617 2074.9708,3394.7596 2090.0855,3414.66 C 2114.2946,3454.0487 2109.1096,3502.6628 2127.7535,3544.1505 C 2133.6547,3580.9195 2155.8535,3611.5372 2165.3959,3646.4935 C 2162.0075,3685.3363 2195.7629,3704.7223 2228.9182,3688.3082 C 2262.1378,3689.3219 2263.5464,3736.8809 2289.6275,3752.6005 C 2307.6613,3771.8701 2336.3705,3782.5959 2345.3402,3749.0504 C 2359.5515,3723.5868 2364.0689,3693.9315 2370.7237,3665.8694 C 2378.6879,3629.8709 2384.8603,3593.4072 2386.1503,3556.5619 C 2394.6177,3530.4945 2406.8451,3505.5384 2418.9573,3480.9721 C 2439.2917,3453.7481 2454.3347,3424.855 2453.5764,3389.9597 C 2455.5295,3368.23 2469.1717,3342.8595 2443.2237,3333.9441 C 2460.8654,3319.5496 2484.5895,3303.2865 2487.4062,3282.7223 C 2518.8168,3283.7939 2551.5483,3279.7115 2570.2511,3251.3491 C 2595.4498,3232.5526 2618.0669,3210.8365 2640.2726,3189.3232 C 2659.2914,3157.1309 2655.9093,3118.0264 2669.2379,3084.019 C 2682.7666,3064.7909 2691.3768,3040.1149 2689.4238,3018.7082 C 2716.938,3049.8212 2749.0002,3016.2954 2775.3141,3000.8158 C 2808.505,2976.3798 2840.6932,2950.1254 2869.0324,2920.1386 C 2889.4108,2882.2547 2907.3322,2843.1295 2925.8533,2804.3235 C 2894.8489,2803.8475 2863.9569,2804.5406 2833.231,2808.4262 C 2811.2422,2806.0855 2759.4245,2818.8893 2761.3126,2788.0136 C 2779.4466,2782.3586 2815.2107,2790.4736 2812.3462,2757.1975 C 2811.7311,2744.4077 2785.8731,2707.8823 2814.5852,2727.5448 C 2842.2938,2751.3238 2874.486,2780.7669 2914.7912,2769.1331 C 2946.9478,2765.4537 2901.2367,2733.0024 2901.7975,2714.2357 C 2893.1509,2684.2256 2883.2422,2657.3623 2857.3049,2638.1702 z\" />\n");
				pw.write("<path id=\"GL2\" d=\"M 2114.9973,2869.9023 C 2123.2979,2875.6092 2129.2599,2884.1546 2133.4225,2893.2115 C 2137.7306,2902.8588 2140.2321,2913.6514 2138.7159,2924.2241 C 2137.7063,2931.4069 2134.1542,2938.432 2128.1376,2942.6736 C 2122.7069,2946.5923 2115.9539,2948.1462 2109.3794,2948.6825 C 2102.1132,2949.2164 2094.6234,2947.1086 2088.9526,2942.4723 C 2081.6016,2936.5564 2077.1572,2927.8555 2074.1214,2919.0917 C 2070.7972,2909.2825 2069.0431,2898.9954 2068.2126,2888.6911 C 2067.9306,2877.9856 2071.9171,2867.1861 2079.1466,2859.277 C 2083.217,2854.8922 2088.7727,2851.2826 2094.9434,2851.3071 C 2100.4144,2851.2846 2105.332,2854.5824 2108.6396,2858.7397 C 2111.3589,2862.0757 2113.3694,2865.9351 2114.9973,2869.9023 z\" />\n");
				pw.write("</g>\n");
				pw.write("<path id=\"NL-N\" style=\"fill:" + NLN + ";\" d=\"M 2141.1204,1006.4259 C 2136.4355,1001.2234 2141.2071,994.82936 2143.801,990.01589 C 2144.4443,984.87205 2137.2891,982.07986 2142.2088,977.0888 C 2145.5083,970.85469 2143.0942,964.02673 2143.1724,957.42929 C 2142.5384,938.87708 2143.7576,920.25322 2146.5125,901.90871 C 2148.6755,895.8189 2155.5555,886.57019 2162.3895,888.8723 C 2167.15,893.7458 2165.5227,901.25172 2165.6806,907.4549 C 2165.759,915.91492 2163.5232,924.11372 2162.8582,932.5 C 2166.1293,927.42737 2171.4153,920.77655 2177.6192,926.36554 C 2181.6832,929.17521 2175.7958,937.12441 2183.1902,935 C 2189.764,935.14488 2195.4804,931.05168 2201.6979,929.44916 C 2207.1366,926.58142 2218.3988,923.79816 2220.3192,931.92694 C 2218.6451,936.74853 2219.437,944.51458 2226.4958,942.21618 C 2231.4273,940.13677 2237.6756,943.12959 2234.1075,948.82144 C 2230.8063,952.46326 2227.654,956.04083 2229.854,960.92937 C 2229.6414,965.03658 2234.0395,967.52116 2234.2372,961.88323 C 2236.2268,956.10924 2243.6929,957.27545 2243.1239,963.63247 C 2246.1643,967.55366 2253.7786,956.8944 2253.4725,964.98925 C 2253.4788,971.70565 2255.2702,978.81988 2252.8934,985.27882 C 2250.4725,991.70494 2242.5557,992.13673 2239.9466,986.45843 C 2237.9194,988.78097 2234.0759,993.5867 2233.202,987.41997 C 2230.9007,982.00399 2233.2784,972.49469 2227.9781,969.68988 C 2226.1812,974.07129 2226.4568,979.47946 2221.227,981.78725 C 2216.7889,987.19161 2219.4185,995.29588 2214.9658,1000.5462 C 2212.2846,1004.3692 2198.2594,1005.8486 2202.756,998.783 C 2206.3635,996.94117 2211.5991,987.76613 2205.5225,987.12081 C 2199.6514,991.24174 2192.9604,987.09734 2187.5207,992.41546 C 2181.6018,996.80657 2174.617,999.15995 2167.3443,1000.0075 C 2159.2427,1002.1711 2151.7865,1006.2127 2143.7645,1008.6328 C 2142.6779,1008.188 2141.8472,1007.3171 2141.1204,1006.4259 z\" />\n");
				pw.write("<path id=\"NL-L\" style=\"fill:" + NLL + ";\" d=\"M 2016.8208,934.50867 C 2008.3464,931.83056 2000.4495,929.62093 1991.6419,929.66589 C 1990.2042,920.84051 1987.9587,909.86596 1977.405,917.99626 C 1967.3038,916.05555 1980.2875,900.38791 1967.2751,898.95028 C 1958.8144,894.20924 1950.8822,881.80307 1960.3562,874.54288 C 1962.4847,864.87294 1970.8113,855.60414 1980.3238,864.55405 C 1988.1007,867.35815 1990.8772,854.77484 1999.5503,860.03579 C 2011.0182,861.98919 1996.1468,871.91652 1993.2945,876.57324 C 1980.7911,882.69549 1998.1851,890.71721 2002.4189,880.98496 C 2009.7251,877.10784 2022.8634,882.84111 2022.9609,869.62025 C 2026.7276,855.97274 2003.7116,876.2083 2007.9693,860.53965 C 2014.994,851.84554 2012.9089,841.01768 2006,833.1196 C 2004.1325,822.43552 1992.1374,816.9012 1992.7999,805.36488 C 1989.3026,795.95998 1994.0285,783.47483 1986.4187,776.08675 C 1977.042,775.178 1974.5414,767.13047 1978.1421,759.82538 C 1978.0361,752.80001 1980.4897,744.41501 1969.5697,747.86075 C 1961.9039,747.42131 1967.9263,731.70273 1958.3295,730.156 C 1956.3683,725.14383 1948.7227,705.62968 1959.3416,716.05494 C 1967.1401,722.68818 1972.8929,731.30629 1981.025,737.23093 C 1990.0994,743.55235 1993.2888,754.39926 2002.834,759.8956 C 2016.4185,760.6531 2009.8986,781.0651 2024.4039,781.08832 C 2028.5715,787.83336 2020.8115,802.00165 2033.0799,805.20986 C 2041.4605,809.53179 2052.6242,808.70236 2058.5492,816.92283 C 2060.7907,820.96045 2065.8491,818.94658 2069.6184,819.70203 C 2078.7151,820.73396 2087.2946,823.47033 2095.231,819.06039 C 2105.1072,818.77028 2114.1878,827.1302 2101.4296,832.60412 C 2093.3789,841.0355 2085.2038,849.46763 2077.758,858.432 C 2072.0129,864.53126 2077.8561,869.67544 2082.3798,862.53976 C 2089.7612,855.58829 2091.9134,845.0567 2100.1703,838.70851 C 2105.0013,830.6306 2114.1486,832.51544 2118.6389,839.147 C 2128.7473,834.82477 2136.4502,843.47978 2144.8219,847.43521 C 2147.2411,851.96912 2143.6931,862.50183 2151.7321,866.79289 C 2161.8641,874.51848 2156.0262,884.79541 2149.1785,892.05178 C 2146.3341,897.04578 2143.4519,897.4167 2140.9761,892.14011 C 2135.6704,879.75007 2123.802,891.51063 2114.7094,892.21726 C 2090.1819,900.7751 2066.5442,911.88809 2041.5,918.92373 C 2034.9356,921.20124 2022.6729,908.0999 2024.0842,921.51427 C 2022.8056,926.54688 2025.6129,936.95628 2016.8208,934.50867 z\" />\n");
				pw.write("<path id=\"NS\" style=\"fill:" + NS + ";\" d=\"M 2121.1346,1071.4297 C 2127.3165,1069.2673 2122.7193,1064.023 2120.5429,1060.6377 C 2124.6046,1051.7378 2126.5837,1041.7666 2131.6089,1033.2362 C 2136.3354,1030.0827 2137.3703,1040.175 2137.2171,1043.6001 C 2137.6412,1049.7789 2146.0636,1048.763 2148.2251,1054.1773 C 2149.984,1059.1881 2145.2542,1065.3082 2141.1031,1067.928 C 2136.128,1067.278 2134.8732,1077.0386 2130.0932,1072.4048 C 2132.3099,1076.6159 2134.0491,1081.5095 2128.9389,1084.548 C 2121.0029,1092.335 2113.6356,1101.2291 2103.4505,1106.1524 C 2099.1161,1108.9003 2098.4443,1117.8376 2091.7595,1115.506 C 2086.8461,1117.7495 2087.8937,1125.127 2084.9784,1129.3672 C 2081.811,1137.7248 2075.0688,1143.9117 2068.6972,1149.8672 C 2062.8687,1148.8747 2056.1771,1147.002 2054.2517,1140.5863 C 2052.3409,1135.4964 2049.789,1129.2506 2053.572,1124.3529 C 2058.2169,1116.1059 2064.5032,1108.9561 2070.7882,1101.9667 C 2075.7318,1099.4205 2081.4271,1097.3179 2085.0096,1092.8359 C 2079.8004,1092.3013 2075.5534,1098.1965 2070.2102,1098.2185 C 2066.7822,1093.9655 2072.8143,1088.1849 2075.1679,1084.3899 C 2078.5975,1080.192 2082.4575,1074.583 2088.7135,1076.0873 C 2096.6596,1075.8074 2105.1697,1075.4297 2112.0416,1070.9816 C 2114.9659,1069.6221 2118.0271,1072.1283 2121.1346,1071.4297 z\" />\n");
				pw.write("<path id=\"PE\" style=\"fill:" + PE + ";\" d=\"M 2100.6702,1071.3369 C 2098.2806,1070.7025 2095.758,1070.7207 2093.2989,1070.5252 C 2087.1981,1070.2626 2081.0562,1069.5705 2075.2273,1067.6717 C 2072.5171,1066.8879 2069.7872,1066.0718 2066.9493,1065.9568 C 2065.3782,1065.9776 2063.9488,1064.5893 2064.524,1062.9764 C 2065.2649,1060.1079 2066.6258,1057.3817 2068.397,1055.0099 C 2069.3954,1053.0637 2071.1969,1054.7268 2072.3168,1055.5832 C 2074.8091,1057.3953 2076.7307,1059.9038 2079.3441,1061.5517 C 2080.9129,1062.4682 2081.8707,1060.174 2083.5184,1060.3308 C 2086.9175,1059.6729 2090.5236,1060.3641 2093.8157,1059.1064 C 2097.2553,1057.4883 2100.973,1056.4856 2104.7084,1055.827 C 2106.0297,1055.2801 2107.0055,1056.1719 2106.2775,1057.4565 C 2105.6264,1059.2344 2104.6762,1060.9098 2104.3797,1062.8086 C 2103.6127,1065.5347 2104.239,1068.6407 2102.6182,1071.101 C 2102.2016,1071.8041 2101.2205,1072.0257 2100.6702,1071.3369 z\" />   \n");
				pw.write("<path id=\"NB\" style=\"fill:" + NB + ";\" d=\"M 2029.5734,1116.2767 C 2025.1805,1114.8306 2024.0018,1109.8764 2021.4384,1106.6222 C 2017.5891,1104.9269 2015.3084,1101.2945 2013.7864,1097.461 C 2010.8331,1090.6211 2008.9242,1083.258 2008.8646,1075.7805 C 2008.3468,1071.2524 2003.7971,1068.9295 2000.3021,1066.8155 C 1997.5413,1065.1286 1994.3207,1064.8641 1991.1776,1065 C 1990.9833,1060.5877 1990.379,1056.1611 1990.7578,1051.75 C 1996.0731,1050.161 2001.989,1051.6683 2007.2107,1049.3733 C 2011.4296,1047.8077 2014.194,1043.845 2018.5869,1042.5787 C 2022.8609,1041.1875 2027.2899,1039.2851 2031.8592,1039.5631 C 2035.5827,1041.3291 2039.5319,1042.4594 2042.1486,1038.3199 C 2045.9061,1035.9109 2050.3383,1033.7885 2054.9011,1034.1246 C 2057.6019,1036.8529 2052.2251,1040.9386 2053.086,1044.6435 C 2052.7384,1048.6501 2053.5196,1052.7958 2056.0368,1056.0121 C 2057.5037,1060.2797 2059.2005,1064.5871 2062.8235,1067.5523 C 2065.5494,1071.0977 2069.8251,1072.5891 2074.1904,1072.003 C 2077.4101,1071.7469 2082.7886,1072.1749 2078.1357,1075.7989 C 2073.736,1080.3309 2069.8317,1085.3675 2067.0792,1091.0766 C 2062.74,1097.6695 2057.3274,1103.7373 2050.7426,1108.1416 C 2047.1173,1108.8191 2044.2616,1110.2167 2042.7644,1113.8687 C 2039.2512,1117.0131 2033.9677,1117.3609 2029.5734,1116.2767 z\" />\n");
				pw.write("<g id=\"QC\" style=\"fill:" + QC + ";\">\n");
				pw.write("<path id=\"QC1\" d=\"M 1898.798,1145.2352 C 1894.6136,1119.2183 1863.9874,1158.8089 1852.6106,1136.0068 C 1836.3831,1125.4827 1808.3432,1131.1554 1801.9295,1107.994 C 1795.0842,1073.0486 1793.2149,1037.1248 1788.2605,1001.8005 C 1788.7554,988.11865 1804.5064,973.12055 1790.0747,956.82187 C 1785.5707,940.3555 1778.074,925.58115 1772.8548,910.90374 C 1790.4766,897.75942 1810.4901,880.4411 1809.9121,856.34992 C 1811.2623,830.76162 1792.9473,814.01514 1774.4365,800.47678 C 1774.802,780.78976 1793.4399,760.09954 1774.2075,741.55633 C 1775.0825,726.75914 1769.478,712.80541 1765.2134,699.71545 C 1771.4775,679.38018 1795.3689,694.72579 1809.6875,691.9287 C 1822.3122,675.04161 1850.7773,693.81201 1856.2822,709.0507 C 1863.3611,717.57605 1889.8745,708.19075 1887.5192,722.69299 C 1889.0832,737.13484 1892.8548,759.12534 1904.4713,766.71047 C 1918.255,764.51193 1932.8423,790.71184 1939.4516,765.38051 C 1954.969,753.5258 1937.9523,730.69128 1951.1256,719.57763 C 1955.4777,730.15369 1961.6348,742.6963 1965.4409,751.33985 C 1984.4955,745.30398 1965.319,770.63843 1977.1647,775.7466 C 1997.2649,785.08767 1982.3138,818.18899 2002.171,831.83875 C 2009.1782,840.2603 2013.775,862.74759 1996.1441,856.11244 C 1986.4864,854.93902 1982.4063,866.53756 1972.0716,857.59013 C 1953.0665,859.5946 1943.8724,897.04254 1969.2021,904.29074 C 1968.0075,914.94646 1972.5283,924.77161 1985.4937,919.77619 C 1985.9573,938.73787 2013.784,937.78745 2025.8564,935.25557 C 2026.4704,922.53846 2027.2097,917.06741 2040.383,922.62362 C 2072.5919,914.0679 2103.0074,898.01006 2134.8644,889.59238 C 2153.4679,905.11929 2115.0311,911.55816 2117.2665,930.7293 C 2112.0679,953.23096 2088.1746,959.53754 2068.7117,964.84548 C 2046.5948,972.31231 2022.2261,976.10382 2002.6544,989.26112 C 2002.3062,1012.5888 1981.2627,1018.3489 1973.4701,1037.8381 C 1964.2243,1055.5652 1959.0544,1075.654 1944.5895,1090.4378 C 1937.0447,1096.8601 1914.3716,1117.6353 1918.8798,1117.9467 C 1934.6507,1099.2359 1957.7935,1086.5904 1966.4806,1062.4503 C 1974.9568,1034.7396 2001.881,1018.4977 2025.2701,1004.158 C 2047.0696,988.50227 2066.8573,1021.4569 2043.0679,1033.4196 C 2023.9127,1037.2719 2002.2261,1044.3663 1987.305,1052.6283 C 1991.1501,1065.8127 1985.5388,1068.9767 1973.5289,1069.2418 C 1963.1275,1087.4073 1968.1883,1110.0168 1958.6384,1128.1573 C 1945.7565,1145.961 1921.0525,1146.0686 1901.0434,1147.5444 L 1899.8325,1146.7099 L 1898.798,1145.2352 L 1898.798,1145.2352 z\" />\n");
				pw.write("<path id=\"QC2\" d=\"M 2062.0132,992.2049 C 2059.5506,991.81018 2057.5459,990.26406 2055.3615,989.20202 C 2052.2633,987.74959 2048.8502,987.27377 2045.623,986.22309 C 2044.0967,985.64804 2041.9763,984.69206 2042.1697,982.74557 C 2042.7014,980.67769 2044.6116,979.32035 2046.337,978.25078 C 2049.6428,976.60201 2053.4725,977.03298 2057.049,976.85586 C 2064.2517,976.71339 2071.575,976.98421 2078.487,979.21766 C 2082.1242,980.40443 2085.8359,981.45252 2089.304,983.08368 C 2091.2448,983.8534 2091.079,986.17373 2090.9623,987.88521 C 2091.0388,989.7281 2089.1115,990.47665 2087.5853,990.65778 C 2081.9636,991.47083 2076.2796,991.76108 2070.621,992.22396 C 2067.7598,992.38327 2064.8606,992.66479 2062.0132,992.2049 z\" />\n");
				pw.write("</g>\n");
				pw.write("<path id=\"ON\" style=\"fill:" + ON + ";\" d=\"M 1749.4712,1249.0557 C 1768.2925,1246.0566 1755.5367,1225.7404 1769.5846,1216.2085 C 1771.5446,1202.9119 1770.1872,1187.997 1777.4253,1176.4431 C 1773.5532,1169.4103 1765.3695,1156.8879 1777.3878,1168.9698 C 1783.8989,1182.1216 1808.8502,1181.726 1796.6018,1164.0493 C 1786.8365,1145.7481 1766.4194,1143.3191 1747.8573,1142.0892 C 1730.8478,1145.1317 1713.8062,1137.6685 1707.491,1121.481 C 1714.024,1106.3696 1692.0848,1099.2494 1681.1306,1093.4936 C 1680.9623,1081.4325 1676.8325,1076.0862 1665.0788,1079.4977 C 1658.4416,1077.78 1642.8222,1069.2164 1643.9886,1081.7303 C 1631.4003,1097.9038 1613.675,1100.8566 1594.421,1095.5132 C 1578.1256,1092.977 1566.4866,1079.7888 1548.7151,1081.5723 C 1535.0208,1079.818 1534.9403,1064.3369 1529.6062,1055.397 C 1530.8652,1028.6766 1531.3534,1001.8068 1533.8326,975.2109 C 1542.6228,958.27907 1559.4023,947.07256 1571.0344,932.1085 C 1591.1375,908.76001 1611.5858,885.70595 1631.8414,862.5 C 1644.751,870.32922 1651.6769,884.31234 1667.5175,887.10943 C 1678.289,889.03436 1685.29,900.02319 1695.8342,900.8737 C 1709.3319,902.10349 1724.0017,899.28303 1736.2441,906.16522 C 1734.1651,919.21139 1734.6211,930.99686 1738.716,943.61337 C 1738.4809,962.2213 1752.5064,976.19562 1765.508,987.78692 C 1770.7951,994.81148 1770.6122,1006.0449 1781.8602,1001.4993 C 1790.5064,1006.2928 1785.1192,1027.5952 1789.2348,1037.973 C 1792.7417,1061.8917 1793.2941,1086.4097 1798.9168,1109.9143 C 1805.0746,1132.4095 1831.791,1128.6686 1847.8893,1138.1452 C 1855.218,1144.1755 1860.9051,1149.1953 1871.3284,1145.9373 C 1879.4671,1145.7045 1896.644,1129.5942 1894.2263,1147.2629 C 1881.6302,1159.1067 1869.5659,1173.0423 1858.6991,1185.3768 C 1843.8783,1191.4779 1824.4597,1188.6923 1813.0889,1202.4226 C 1800.8107,1212.4173 1836.6362,1215.8428 1816.7933,1220 C 1806.0269,1219.7912 1797.1676,1228.1522 1800.3803,1232.3684 C 1779.5655,1222.773 1771.4428,1248.349 1754.5778,1251.2462 C 1752.3083,1249.9491 1745.037,1254.7811 1749.4712,1249.0557 z\" />\n");
				pw.write("<path id=\"MB\" style=\"fill:" + MB + ";\" d=\"M 1453.2188,765.84375 C 1451.6372,784.72525 1446.8393,803.40107 1446.5649,822.3106 C 1451.222,831.60803 1436.3922,839.20968 1440.5313,850.5 C 1436.841,907.35367 1432.3672,964.15965 1428.5,1021 C 1427.2713,1033.7912 1426.555,1046.6467 1426.5,1059.5 C 1459.2341,1062.7045 1491.8083,1068.0464 1524.7812,1068.125 C 1528.1946,1037.3481 1527.4636,1006.2412 1530.3538,975.43081 C 1533.8984,963.87718 1544.9776,956.56256 1552.3221,947.38991 C 1577.8913,920.28416 1601.3533,891.29109 1626.4932,863.80076 C 1627.5769,855.44669 1609.7625,857.86222 1603.9811,852.35582 C 1595.1459,851.07482 1575.2337,863.62997 1578.8384,846.63189 C 1574.4447,834.93174 1577.4936,819.01778 1568.3779,810.16428 C 1557.4801,807.85776 1543.981,804.96795 1549.116,790.19541 C 1547.3953,786.11665 1554.6335,774.66541 1547.0244,775.91504 C 1517.9921,773.74288 1489.142,769.24671 1460.1219,766.67483 C 1457.8196,766.4089 1455.5197,766.12173 1453.2188,765.84375 z M 1481.8125,937.71875 C 1493.9856,941.33805 1497.6681,957.03327 1499.7889,968.30062 C 1504.9206,978.53461 1501.9956,990.93197 1507.9119,1001.1451 C 1513.8139,1011.0618 1513.5958,1032.6298 1498.6875,1029.5625 C 1492.3678,1020.6684 1511.2479,1005.5843 1500.493,1002.0204 C 1490.7687,1012.0108 1504.803,981.8764 1489.1875,987.78125 C 1478.5539,986.82173 1477.412,968.86271 1472.8529,961.4061 C 1457.1749,949.59053 1460.6802,973.97351 1459.9475,983.06286 C 1464.1382,993.35576 1478.9532,998.80108 1475.8125,1013.0938 C 1477.0823,1019.3621 1487.0891,1037.9908 1473.4063,1033.875 C 1468.645,1022.885 1471.5438,1008.406 1462.7803,999.53696 C 1452.3879,995.37707 1447.8448,986.40419 1453.6181,976.72285 C 1459.5143,966.54889 1437.2867,961.18312 1446.4688,954 C 1455.6452,952.24381 1440.1581,939.30398 1454.4063,940.8125 C 1461.2509,939.83717 1464.6082,960.21375 1467.9375,950.34375 C 1470.2332,944.36695 1474.3012,937.09129 1481.8125,937.71875 z\" />\n");
				pw.write("<path id=\"SK\" style=\"fill:" + SK + ";\" d=\"M 1419.9167,1058.6132 C 1393.3352,1055.4724 1366.4859,1053.6675 1340.4965,1046.7692 C 1320.2208,1041.9674 1299.6837,1038.1299 1279.5536,1032.8121 C 1278.3218,1023.619 1284.1349,1012.3365 1285.5186,1002.3391 C 1304.0368,924.9388 1322.4984,847.52548 1341.1498,770.15674 C 1352.4852,771.21241 1363.8068,772.97439 1375.1703,771.09034 C 1380.1608,772.65522 1397.9724,778.27583 1385.9118,770.80568 C 1373.3359,764.59671 1359.1251,757.48568 1345.9343,757.03518 C 1341.134,756.89113 1346.2712,740.55851 1353.5064,747.64403 C 1385.2746,753.90773 1417.146,760.208 1448.9234,766.05167 C 1449.2788,779.65977 1445.7912,793.43479 1444.4127,807.08613 C 1447.4853,820.93542 1430.9648,824.28097 1430.4272,836.47959 C 1436.2104,844.3385 1428.025,851.42615 1427.518,857.51128 C 1432.1605,854.19493 1439.1279,850.23054 1436.6477,859.9999 C 1431.9571,925.38667 1427.3196,990.78163 1422.6055,1056.1541 C 1422.8947,1057.0837 1421.4294,1060.6351 1419.9167,1058.6132 z\"  />\n");
				pw.write("<path id=\"AB\" style=\"fill:" + AB + ";\" d=\"M 1259.5,1028.0212 C 1243.7019,1023.3741 1227.2316,1020.6009 1211.9642,1014.3769 C 1208.6891,1009.8305 1204.5075,1003.7751 1206.8938,997.85438 C 1208.9229,987.79822 1212.1189,976.66193 1205.3252,967.58561 C 1197.768,954.14882 1193.3343,939.28149 1185.861,925.85318 C 1179.6851,914.00427 1173.7716,902.14582 1170.5261,889.01072 C 1167.0835,879.60761 1155.1064,875.14147 1161,864.32929 C 1166.0639,841.70237 1175.4941,820.24301 1182.8608,798.27542 C 1193.9102,767.59918 1205.0661,736.96146 1216.2095,706.31927 C 1257.8967,720.70521 1300.3694,732.59832 1342.5941,745.26073 C 1346.4452,761.89813 1324.6566,764.53399 1323.0574,776.81699 C 1330.5729,787.26931 1340.2778,762.78819 1335.2815,779.92059 C 1315.4141,863.32211 1295.5297,946.72584 1275.3389,1030.0485 C 1274.1564,1035.1365 1262.9424,1027.0696 1259.5,1028.0212 z\" />\n");
				pw.write("<g id=\"BC\" style=\"fill:" + BC + ";\">\n");
				pw.write("<path id=\"BC1\" d=\"M 1047,975.73993 C 1040.667,971.1597 1035.5741,964.87493 1031.9293,957.98918 C 1030.8792,954.5396 1030.8409,950.69159 1026.4689,949.7984 C 1021.452,945.4851 1022.3602,938.10488 1018.6221,933 C 1015.0046,927.06496 1013.0237,920.29883 1009.2311,914.44573 C 1005.6605,908.85675 1003.6774,902.47761 1002.3752,896.02301 C 1001.8787,892.47749 997.8862,887.83809 1002.5198,885.50705 C 1005.7066,881.66659 1010.1967,883.35089 1012.7972,886.75539 C 1020.3414,894.12148 1027.0444,902.29567 1033.8838,910.30258 C 1036.1369,913.40514 1038.8009,916.24107 1040.9123,919.41467 C 1043.5332,925.36263 1044.2469,931.87329 1045.3009,938.21281 C 1047.6491,946.12772 1055.9508,951.08662 1056.925,959.59372 C 1057.5476,965.1178 1058.6339,970.57476 1060.2814,975.87975 C 1060.3645,979.75508 1054.267,977.69156 1051.7451,977.48178 C 1050.1038,977.10065 1048.4497,976.62318 1047,975.73993 z\" />\n");
				pw.write("<path id=\"BC2\" d=\"M 1205.5,1013.4345 C 1158.3878,999.81943 1112.8978,981.34039 1067.1901,963.73163 C 1063.7892,948.12849 1046.8956,940.17528 1045.4855,923.02961 C 1039.2125,914.21064 1032.3525,904.19656 1030.5152,895.7688 C 1015.4182,890.1191 1016.3535,869.20807 1022.1477,857.52917 C 1031.9614,844.3833 1006.871,830.165 1019.555,817.47139 C 1014.7089,804.86549 1008.2824,782.37169 1022.884,774.47748 C 1038.8607,769.42106 1044.3441,750.4082 1046.9135,736.09644 C 1037.2878,722.35322 1027.3335,705.32303 1035.919,687.92402 C 1036.3524,671.37922 1034.1213,654.38507 1031.1945,637.97311 C 1029.9235,626.3767 1023.6761,596.63798 1008.6777,612.67319 C 999.25236,616.01913 984.77441,627.50404 990.68202,610.00384 C 990.12517,601.50257 981.16141,576.61958 997.6538,591.06001 C 1053.7762,627.91409 1111.4226,663.15577 1173.3662,689.41242 C 1185.0111,696.49137 1205.7691,697.66118 1212.0827,708.09787 C 1194.5684,757.51743 1175.4243,806.38786 1159.1198,856.22017 C 1154.4415,869.21671 1155.9659,879.29997 1166.4968,888.60296 C 1170.8935,904.91463 1178.5833,919.71665 1186.5533,934.44695 C 1192.7594,949.89681 1200.9941,964.65556 1206.3761,980.42366 C 1205.0097,991.20925 1201.7778,1005.5723 1205.5,1013.4345 z\" />\n");
				pw.write("<path id=\"BC3\" d=\"M 976.23962,824.73291 C 970.95458,812.43691 970.82658,798.76131 971.45855,785.61957 C 971.76251,781.35075 971.79188,776.99629 972.90297,772.84005 C 974.76808,771.11775 973.70777,766.84768 977.16679,767.2274 C 981.63298,767.54759 984.99984,770.90824 988.23927,773.64679 C 990.29669,775.62471 992.5593,777.54267 993.92715,780.08581 C 993.33416,782.46911 990.94607,784.20251 989.47068,786.1832 C 985.57686,790.72173 980.92807,794.63199 977.58578,799.62377 C 975.03846,803.39193 976.01264,808.15297 977.07741,812.24242 C 978.3988,817.57115 980.16412,822.8126 980.98758,828.25 C 981.06384,831.86846 977.74819,828.51451 977.28947,826.88531 C 976.90254,826.18664 976.55652,825.46582 976.23962,824.73291 z\" />\n");
				pw.write("</g>\n");
				pw.write("<path id=\"YT\" style=\"fill:" + YT + ";\" d=\"M 1160.4397,680.67529 C 1119.5372,660.58175 1078.9255,639.64968 1040.7076,614.72218 C 1023.3863,603.37261 1005.2234,593.12573 988.93085,580.31868 C 985.58376,572.81636 1006.7227,562.31376 989.26205,561.35373 C 979.09388,560.9527 969.26491,551.8822 980.11739,542.65612 C 1026.1645,474.51603 1072.0599,406.27273 1118.1348,338.15103 C 1132.4426,339.56678 1130.0619,355.46473 1135.378,365.06299 C 1136.0344,375.1797 1151.1656,380.01227 1138.9232,389.07591 C 1129.593,402.0469 1124.6946,417.29553 1118.6737,431.85217 C 1122.3668,442.03955 1145.0284,446.07936 1133.4229,459.7501 C 1127.5723,468.56201 1128.1506,478.92166 1135.7558,485.48168 C 1138.3787,496.90154 1123.942,496.92934 1123.9763,508.31552 C 1123.3245,520.48906 1130.9044,532.74266 1131.7609,546.15516 C 1136.1988,557.30962 1127.1585,568.91095 1127.8488,580.66809 C 1124.7898,592.47633 1125.9615,601.48442 1132.7964,611.40652 C 1137.9877,623.59282 1141.0109,633.65236 1136.2991,646.47793 C 1142.1182,655.05584 1159.0909,656.37625 1163.4372,662.85209 C 1162.2099,667.77506 1165.6657,682.09577 1160.4397,680.67529 z\" />\n");
				pw.write("<g id=\"NT\" style=\"fill:" + NT + ";\">\n");
				pw.write("<path id=\"NT1\" d=\"M 1172.0625,374.25 C 1161.181,374.1029 1149.6747,375.65018 1150.9934,387.29655 C 1140.4526,379.28955 1134.263,408.66567 1128.0313,417.5 C 1116.8772,430.89982 1127.5844,438.43387 1138.683,445.83412 C 1142.2855,459.06237 1124.9736,474.2971 1139.1877,485.09919 C 1139.9264,499.55338 1118.7023,506.25169 1130,522.0625 C 1137,541.14993 1137.9923,559.6707 1131.3851,579.32666 C 1126.4716,597.24307 1136.3461,614.03488 1144.6739,629.26926 C 1138.3585,638.24435 1137.8624,651.43335 1153.3541,653.19244 C 1161.1685,657.41654 1170.5844,654.58275 1166.4256,667.99995 C 1167.5805,674.36061 1162.9299,684.66711 1172.2339,685.50061 C 1231.1451,709.64137 1292.3415,727.78457 1353.7451,744.2502 C 1384.1975,750.15147 1414.5527,756.72906 1445.153,761.75956 C 1457.661,754.93582 1449.866,728.09697 1454.6843,713.86152 C 1456.9471,688.25246 1459.9527,662.66186 1461.5313,637.03125 C 1438.7029,623.28124 1413.5415,612.63745 1391.116,598.62248 C 1386.6785,592.42851 1383.5549,584.37149 1378.3358,579.28561 C 1371.0766,577.24463 1362.6996,576.92175 1356.1049,573.82855 C 1334.4071,544.3403 1312.5683,514.88129 1291.6106,484.90334 C 1292.5667,468.09363 1311.6228,450.26917 1300.4375,434.1875 C 1294.4721,418.97706 1278.56,426.88215 1268.7582,428.12604 C 1275.4181,422.65143 1274.7377,396.07334 1262.4375,413.34375 C 1246.1718,432.47327 1251.4483,399.8729 1248.9059,390.03838 C 1239.9919,385.59445 1225.1614,399.33031 1227.5808,382.89158 C 1213.7582,375.91731 1197.0021,381.7495 1182.7188,383.5625 C 1171.4648,391.15931 1180.2302,373.77407 1172.0625,374.25 z M 1254.9062,514.40625 C 1267.3777,512.74265 1295.2381,514.0728 1274.3596,529.15431 C 1284.0571,534.72762 1314.6878,541.40912 1291.1707,552.16062 C 1283.9804,558.30075 1270.698,538.24466 1268.5625,554.6875 C 1267.5197,566.33525 1238.6925,570.10782 1256.1018,555.79793 C 1256.7125,548.83607 1230.0608,569.44068 1231.0459,549.87585 C 1237.6552,540.32286 1267.3725,526.82668 1240.7761,524.2093 C 1230.6992,525.5875 1222.0218,511.85925 1237.0747,514.53279 C 1243.0176,514.41017 1248.9624,514.38757 1254.9062,514.40625 z M 1288.9062,643 C 1301.0274,653.2034 1307.9922,671.72198 1324.2689,675.00655 C 1337.098,679.20815 1349.4573,655.78759 1359.3125,666.28125 C 1349.0942,680.16656 1330.3147,691.47566 1312.6645,694.99421 C 1298.3541,708.55294 1273.606,702.90421 1262.6385,687.71038 C 1260.5464,676.1709 1283.3624,690.91348 1287.2995,678.15932 C 1312.0883,680.34835 1285.1468,652.20535 1288.9062,643 z\" />\n");
				pw.write("<path id=\"NT2\" d=\"M 1395.5,450.98141 C 1378.6307,446.02697 1361.7704,441.02998 1344.9023,436.07959 C 1343.1203,434.15626 1350.9737,434.91612 1352.7116,434.66578 C 1361.2294,434.9922 1370.3945,434.11164 1378.1126,438.46621 C 1383.1329,440.26616 1388.2681,442.42692 1393.618,442.71532 C 1389.5253,437.51478 1384.4942,432.75437 1378.6191,429.58488 C 1373.5219,427.2842 1367.6872,427.98125 1362.4225,426.07485 C 1355.8306,424.21439 1348.9191,422.83586 1342.9024,419.45328 C 1340.2771,415.77842 1337.4482,409.33056 1338.9463,405.34717 C 1345.848,402.32721 1353.2766,400.76171 1360.5,398.68365 C 1356.7099,397.60039 1352.6942,397.36671 1348.9588,396.2557 C 1343.701,394.16863 1347.1777,387.9067 1342.8717,385.38937 C 1338.7006,381.44076 1340.4816,375.08507 1344.4655,371.74263 C 1349.4743,368.4096 1348.9263,361.98903 1352.5491,358.00459 C 1363.8874,348.64896 1378.886,345.90898 1392.9982,343.64517 C 1399.7763,340.45326 1401.5816,348.70348 1399.7349,353.55572 C 1399.6197,357.60021 1394.5903,362.62308 1395.9415,365.62319 C 1399.3319,363.89797 1402.0473,361.16231 1405.0277,358.84338 C 1410.9743,362.31578 1417.2266,365.43364 1422.3522,370.1058 C 1420.9979,373.31135 1419.6436,376.51688 1418.2893,379.72238 C 1421.2647,378.96181 1424.4288,378.65075 1427.1673,377.19265 C 1427.81,372.82136 1422.1169,366.90101 1428.9011,365.34216 C 1433.864,362.80115 1429.3728,371.39504 1429.4523,373.91976 C 1423.1391,400.34888 1416.7809,426.77932 1409.5947,452.9862 C 1406.86,455.82678 1400.7908,451.72494 1396.8278,451.36399 L 1396.1672,451.17475 L 1395.5,450.98141 L 1395.5,450.98141 z\" />\n");
				pw.write("<path id=\"NT3\" d=\"M 1296.5614,385.85788 C 1294.7809,377.69406 1295.5545,368.70059 1290.6142,361.49921 C 1288.2097,356.68461 1284.1669,352.1931 1283.1656,346.95806 C 1285.2374,342.38592 1290.5003,340.67162 1292.9307,336.34411 C 1297.9179,329.29702 1302.0834,321.66429 1307.8702,315.20248 C 1312.1759,309.20904 1317.4768,303.7502 1320.5583,296.99291 C 1322.6282,291.7341 1318.4705,284.37922 1324.0222,280.78381 C 1328.657,280.57565 1333.5765,281.91626 1338.0585,283.43554 C 1342.455,285.32368 1347.1445,286.39577 1351.6143,288.0285 C 1354.8388,291.62683 1356.4789,296.74189 1360.4677,299.95381 C 1363.5261,304.43062 1368.5738,306.16163 1373.7974,305.24071 C 1380.4959,304.54955 1382.7287,311.84895 1384.3819,316.86086 C 1386.2473,323.2839 1389.3891,329.70513 1388.8814,336.52757 C 1387.6673,341.79391 1381.3302,342.56568 1376.9701,343.87113 C 1370.5139,345.42139 1363.9001,347.48797 1358.75,351.79668 C 1351.7911,354.37998 1346.8668,360.18774 1340.8015,364.23015 C 1335.2566,367.7893 1332.3538,373.74732 1329.1023,379.20599 C 1326.8533,384.5588 1321.0244,384.11362 1316.2977,385.29943 C 1310.1993,386.3558 1303.917,387.12021 1297.7309,386.68914 C 1297.2693,386.5849 1296.7178,386.35966 1296.5614,385.85788 z\" />\n");
				pw.write("<path id=\"NT4\" d=\"M 1412.6206,310.92267 C 1410.9146,308.40084 1406.1373,304.94435 1409.1076,301.77466 C 1414.2531,297.13224 1422.1345,298.50333 1427.5457,294.3976 C 1427.515,291.12959 1421.7095,293.35287 1419.3687,291.99309 C 1416.9335,290.97325 1415.3537,285.92289 1412.7208,289.70098 C 1408.9549,291.96128 1403.2085,292.45946 1400.076,288.84047 C 1396.1603,284.88074 1392.3834,280.65723 1389.5946,275.81427 C 1388.3511,272.61468 1391.2966,268.8209 1394.6273,268.77969 C 1395.5661,266.10006 1396.1339,262.75636 1398.6912,260.79021 C 1401.2255,258.49665 1400.725,254.76326 1402.9244,252.27025 C 1404.7212,249.98453 1406.705,247.21849 1409.7907,246.80273 C 1412.6243,244.71839 1414.6506,240.94733 1418.8882,242 C 1422.8706,241.8535 1427.9591,243.40018 1428.8286,247.85704 C 1428.6797,250.98179 1429.7147,254.15583 1432.822,255.50089 C 1438.602,259.0175 1440.6462,266.12398 1440.5269,272.53146 C 1440.5502,275.80275 1441.1635,280.5758 1445.2937,280.90253 C 1448.6559,280.35461 1452.2849,282.01707 1450.7188,285.96067 C 1449.391,292.65556 1447.8885,299.3559 1445.6851,305.82189 C 1444.1871,309.23286 1439.4007,309.27663 1436.8845,312 C 1433.8764,314.33305 1430.3341,316.24391 1426.4082,315.98147 C 1423.3527,316.01684 1420.2969,315.99303 1417.2412,316 C 1415.701,314.30756 1414.1608,312.61511 1412.6206,310.92267 z\" />\n");
				pw.write("<path id=\"NT5\" d=\"M 1381.7783,266.31613 C 1380.6018,265.82829 1380.0093,264.55977 1379.4886,263.47623 C 1378.6011,261.31925 1378.1288,258.65076 1379.4842,256.57752 C 1380.9866,254.34836 1383.5175,253.15525 1385.8803,252.0575 C 1388.5529,250.94295 1391.2379,249.76296 1394.0917,249.19721 C 1395.3761,248.93562 1396.9283,249.08201 1397.7412,250.25 C 1398.7495,251.41042 1398.9608,253.15768 1398.2122,254.50831 C 1397.0234,256.82885 1394.6502,258.11898 1392.7553,259.78503 C 1390.5112,261.5837 1388.422,263.56264 1386.2244,265.41509 C 1385.3987,265.90523 1384.6387,267.093 1383.5754,266.77408 C 1382.9751,266.62657 1382.3762,266.47272 1381.7783,266.31613 z\" />\n");
				pw.write("<path id=\"NT6\" d=\"M 1372.5714,249.42857 C 1370.2849,247.36155 1372.1393,242.02683 1367.5818,243.01863 C 1363.9052,242.96973 1359.3426,243.22698 1356.8541,239.98315 C 1354.9575,236.68523 1357.3568,232.86593 1359.5369,230.35022 C 1362.3728,227.40167 1366.7615,227.40884 1370.2467,225.61266 C 1373.4788,224.3973 1376.2842,222.1116 1379.7076,221.43463 C 1382.2698,220.90848 1384.1265,218.46933 1386.1965,216.91767 C 1390.3513,213.36732 1393.987,208.89439 1399.1456,206.76081 C 1403.8097,205.32648 1408.7601,206.47055 1413.5389,205.89002 C 1416.9851,205.16007 1421.0326,206.18568 1423.173,209.12015 C 1425.537,214.02285 1423.1377,220.33091 1418.3815,222.80635 C 1415.6898,225.34923 1416.6974,229.50543 1415.5807,232.74283 C 1414.2624,235.74003 1410.6286,236.44464 1408.3932,238.56673 C 1405.9776,240.17151 1404.9533,243.87677 1401.5202,243.67192 C 1398.3084,243.67489 1397.7538,239.76939 1398.0222,237.29002 C 1398.0064,234.49432 1399.7247,232.30819 1401.6572,230.50965 C 1402.6011,228.20948 1399.0775,231.38641 1398.5049,231.95446 C 1392.1659,237.537 1386.7502,244.13556 1380.0503,249.30435 C 1378.0897,250.97869 1374.8393,251.96783 1372.8847,249.72908 L 1372.5714,249.42857 L 1372.5714,249.42857 z\" />\n");
				pw.write("<path id=\"NT7\" d=\"M 1450.3461,222.04359 C 1448.0404,221.15909 1446.1252,219.39848 1445.1428,217.12177 C 1443.867,214.35944 1442.679,211.51623 1442.0114,208.5408 C 1441.8314,206.47369 1439.5588,205.76875 1438.2921,204.47618 C 1435.9617,202.13785 1434.2553,198.87093 1434.432,195.50428 C 1434.4151,193.85875 1436.0902,192.51163 1437.672,193.13163 C 1439.6324,193.86681 1441.4064,195.50643 1441.9648,197.56239 C 1442.0134,199.65653 1444.6388,198.52961 1445.9287,198.37168 C 1452.0374,197.5127 1458.2179,197.2493 1464.3809,197.13492 C 1465.9276,197.36661 1468.0692,196.61751 1469.1862,197.97834 C 1469.6423,199.84038 1468.8312,201.72404 1468.5132,203.55378 C 1467.2185,208.83927 1466.625,214.35201 1464.4331,219.37628 C 1463.5406,221.76616 1461.0704,223.04973 1458.6559,223.33479 C 1455.8395,223.71588 1452.9323,223.18999 1450.3461,222.04359 z\" />\n");
				pw.write("<path id=\"NT8\" d=\"M 1468,193.12132 C 1467.6582,192.26298 1466.6906,191.87431 1465.9404,191.42921 C 1463.7544,190.49986 1461.6301,189.28691 1460.026,187.50326 C 1459.0284,186.44255 1457.4677,186.13772 1456.0872,186.48276 C 1454.9936,186.70741 1453.746,186.86537 1452.737,186.28158 C 1451.9565,185.49877 1452.5138,184.26421 1452.9892,183.4665 C 1454.2759,181.46948 1456.1545,179.85118 1458.2893,178.81724 C 1459.2293,178.37932 1460.4012,178.07612 1461.3433,178.66884 C 1462.4374,178.94038 1463.2593,178.02242 1464.1812,177.65441 C 1466.3986,177.09962 1468.73,177.19614 1470.9872,177.41955 C 1471.8449,177.6338 1473.2272,177.52411 1473.5693,178.50473 C 1473.5895,180.53047 1473.0339,182.51079 1472.6122,184.47855 C 1471.8673,187.42792 1471.1284,190.40652 1469.8993,193.19849 C 1469.7485,194.33479 1468.1304,194.12325 1468,193.12132 L 1468,193.12132 z\" />\n");
				pw.write("</g>\n");
				pw.write("<g id=\"NU\" style=\"fill:" + NU + ";\">\n");
				pw.write("<path id=\"NU1\" d=\"M 1472.5,509.07346 C 1461.8549,506.43963 1454.8374,497.30078 1445.1441,492.83275 C 1444.4594,489.15954 1440.682,483.96269 1437.9743,490.02883 C 1432.1707,496.69172 1421.8315,492.68324 1415.5096,498.37693 C 1404.7252,501.29944 1393.3376,499.10056 1382.3414,498.79686 C 1374.8344,498.78057 1364.8896,497.58201 1367.2928,487.48217 C 1367.1407,479.79351 1366.7266,468.90461 1356.5352,468.78275 C 1348.114,465.46019 1339.5321,459.59639 1339.5774,449.66543 C 1339.2087,445.12116 1333.2041,433.78661 1342.506,438.79159 C 1365.5694,445.29071 1388.3694,452.76083 1411.5637,458.76967 C 1419.7003,428.60756 1426.6277,397.95174 1434.8021,367.9124 C 1438.5489,374.1243 1441.5697,381.17538 1442.7454,388.39478 C 1444.1291,394.35081 1439.5201,405.75322 1445.5327,408.26743 C 1451.5693,401.7964 1446.858,391.5713 1447.8239,383.49761 C 1447.5968,377.56504 1447.3796,371.6321 1447.1577,365.69934 C 1450.5301,361.47545 1455.5145,357.04297 1460.8864,361.40322 C 1463.4771,362.71989 1467.4582,368.64908 1463.8358,362.61655 C 1456.3437,353.18611 1471.323,344.91384 1478.7715,350.87164 C 1484.9889,354.52237 1488.1052,362.98611 1482.5966,368.74416 C 1480.1087,372.85804 1476.1339,376.27676 1473.864,380.36291 C 1474.2618,394.90546 1473.5914,409.76067 1478.0287,423.7882 C 1476.0223,430.95654 1471.2406,439.17392 1477.4995,445.95195 C 1484.0535,457.19692 1497.5384,462.57883 1502.7482,474.69745 C 1506.5017,482.97017 1498.8316,487.13284 1491.8776,483.72466 C 1486.2134,479.28275 1483.8981,485.16786 1487.9377,489.52303 C 1494.7914,496.27596 1492.0635,508.00306 1482.0283,509.33159 C 1478.9038,510.20754 1475.6051,509.8295 1472.5,509.07346 z\" />\n");
				pw.write("<path id=\"NU2\" d=\"M 1751.1121,962.23373 C 1745.9814,960.18094 1745,959.39886 1745,957.36277 C 1745,954.62148 1745.5458,954.34513 1752.4379,953.5968 C 1757.0352,953.09763 1757.5727,953.2813 1760.2321,956.26001 C 1763.9056,960.37451 1763.7282,964.34485 1759.8621,964.54357 C 1758.4113,964.61815 1754.4738,963.57872 1751.1121,962.23373 z\" />\n");
				pw.write("<path id=\"NU3\" d=\"M 1541.9167,772.61322 C 1512.5096,768.46742 1482.7155,766.29709 1453.4022,761.97127 C 1457.2657,719.9799 1461.7601,677.86507 1465.1034,635.88293 C 1443.3538,621.22648 1418.3003,611.35032 1395.8215,597.63107 C 1386.9811,591.83907 1386.8361,575.43127 1374.8604,575.12485 C 1367.7755,572.70775 1357.9598,574.52677 1354.5669,566.38254 C 1334.802,538.72188 1313.9046,511.79333 1294.9922,483.57289 C 1301.2975,474.08737 1301.3926,446.15086 1312.7363,448.15266 C 1323.2549,462.25509 1336.1353,471.74616 1351.3686,476.06891 C 1362.5466,484.57139 1366.6702,503.10412 1346.9532,501.43943 C 1340.9963,515.70591 1372.9342,519.65651 1384.5314,518.99499 C 1402.0775,509.23074 1412.0528,538.7966 1415.9382,549 C 1420.2243,541.26071 1409.7554,526.6275 1421.6342,524.18595 C 1428.5588,521.88462 1446.3809,509.28581 1429.1703,516.57548 C 1414.0107,527.50851 1406.8584,501.44556 1425.3382,502.08052 C 1438.7422,495.89165 1450.5683,499.80688 1451.5797,515.76023 C 1459.5121,526.27531 1473.0631,528.15593 1479.1418,539.83445 C 1491.2854,538.44762 1511.939,546.84506 1517.7,541.35321 C 1514.8808,517.1709 1537.5849,526.90392 1549.8451,534.54873 C 1544.6506,543.12486 1544.2943,563.33767 1551.7675,562.36429 C 1549.5952,550.26393 1545.2882,534.22025 1563.1172,535.12119 C 1576.6129,526.10489 1569.0151,506.30759 1564.2547,496.29709 C 1544.5979,491.93361 1548.6476,472.06095 1545.8782,457.93342 C 1539.2462,448.87176 1551.9307,440.14122 1554.8317,434.52991 C 1554.9898,421.92304 1571.9982,412.89989 1577.2651,428.9378 C 1589.0538,441.99718 1586.1605,462.35412 1595.9935,477.20725 C 1585.3314,477.56406 1587.388,501.61485 1602.6907,493.60486 C 1613.4929,494.46921 1618.919,502.25671 1603.9211,502.42151 C 1600.6316,508.86984 1612.1669,522.6346 1610.9923,527.8491 C 1610.7119,519.59724 1617.0906,495.06136 1626.8636,508.64245 C 1643.8927,519.2201 1631.755,536.22322 1636.9466,550 C 1642.8168,567.94022 1654.8027,556.31751 1653.2888,542.34781 C 1658.5608,524.60837 1670.4806,509.98887 1659.5201,492.38686 C 1664.8891,470.99701 1692.0111,492.40045 1703.0237,499.8106 C 1709.8054,505.30903 1704.6126,512.86754 1709.6193,521.35234 C 1684.7308,528.94599 1715.2936,544.40025 1712.4478,559.52415 C 1711.3126,575.10616 1694.2197,590.99179 1685.8524,584.79578 C 1690.5536,598.63593 1667.3441,589.38527 1661.5,586.57179 C 1645.7046,587.13387 1670.3117,599.87295 1656.9136,607.51342 C 1646.5074,616.28081 1646.9983,623.72848 1650.1977,634.06876 C 1642.5299,648.89105 1634.4607,666.29706 1615.1781,664.41728 C 1616.5967,677.67023 1601.208,670.57132 1598.1788,674.35976 C 1617.1274,685.3748 1593.1561,698.83217 1586.2594,699.25 C 1581.6077,712.06463 1565.9639,724.20759 1561,738.66102 C 1553.594,748.00085 1554.0714,767.97062 1547.5818,773 C 1545.6885,772.98883 1543.7683,773.08046 1541.9167,772.61322 z\" />\n");
				pw.write("<path id=\"NU4\" d=\"M 1743.8569,717.30664 C 1738.5288,714.00033 1738.745,704.2309 1744.2789,698.24071 C 1746.5254,695.80901 1749.0677,695.97887 1752.25,698.77327 C 1755.4535,701.58629 1753.8721,713.17792 1749.7626,717.00651 C 1747.2083,719.38627 1747.2082,719.38627 1743.8569,717.30664 z\" /> />\n");
				pw.write("<path id=\"NU5\" d=\"M 1692.0627,706.11725 C 1690.8347,703.56002 1691.2838,700.58823 1691.9847,697.94745 C 1693.0149,694.47775 1694.7499,691.02027 1697.6709,688.77115 C 1699.6105,687.36495 1701.7867,686.10882 1704.236,685.96862 C 1707.2537,685.74886 1710.2917,685.83331 1713.3094,686.01399 C 1714.5951,686.05796 1715.9713,686.60453 1716.4881,687.87375 C 1717.2189,689.40835 1718.1057,691.20803 1717.3341,692.90439 C 1716.3488,695.10346 1714.976,697.11546 1713.5453,699.04701 C 1710.0614,703.6044 1704.8912,707.04854 1699.1204,707.72048 C 1697.3374,707.85517 1695.4989,708.16973 1693.7361,707.73815 C 1692.9398,707.50969 1692.4231,706.82232 1692.0627,706.11725 z\" />\n");
				pw.write("<path id=\"NU6\" d=\"M 1669.75,684.23499 C 1666.3339,682.04993 1669.1847,676.70693 1667.0411,673.53753 C 1664.2799,671.39524 1660.3096,672.15649 1656.9912,671.77723 C 1652.6416,672.46532 1646.29,668.97967 1650.8985,664.49667 C 1653.8204,661.00667 1657.7281,657.48503 1657.2346,652.45778 C 1656.8535,639.83064 1656.5793,627.00178 1659.8092,614.67372 C 1661.2981,610.94726 1660.48,604.63197 1665.3711,603.59558 C 1669.9358,601.69332 1672.619,606.52112 1674.3793,609.89009 C 1675.9535,613.5324 1677.4882,617.9656 1682.3433,617.45195 C 1689.948,620.76715 1696.2621,626.33941 1703.1933,630.80349 C 1706.5754,633.33461 1710.7115,635.34266 1712.9843,639 C 1713.9769,643.34438 1717.6677,646.65012 1718.1635,651.15819 C 1721.6716,652.75952 1726.0213,649.89555 1729.599,651.89593 C 1733.6741,653.83903 1737.0912,657.77055 1735.2193,662.51279 C 1734.733,666.87659 1730.1153,669.11665 1726.404,670.22135 C 1722.4642,669.52164 1718.9213,666.84217 1714.7358,667.23562 C 1710.2358,668.74186 1705.8952,664.85078 1705.9442,660.38805 C 1703.6289,657.50926 1699.7235,655.41375 1695.9852,655.73358 C 1692.5963,658.44639 1694.7299,663.85181 1691.6364,667.0302 C 1688.7856,670.85126 1685.214,674.09675 1682.4555,678.01381 C 1679.6668,681.65779 1676.2342,685.72475 1671.0688,684.41631 L 1670.37,684.34322 L 1669.75,684.23501 L 1669.75,684.23499 z\" />\n");
				pw.write("<path id=\"NU7\" d=\"M 1538.395,526.65576 C 1533.056,524.80534 1528.8643,520.86624 1524.6808,517.23578 C 1523.2784,515.80621 1521.0992,515.97522 1519.6796,514.54398 C 1518.1952,513.2173 1516.125,511.75946 1516.0455,509.61038 C 1517.5226,506.10115 1519.9098,503.06346 1522.036,499.92884 C 1525.4333,495.30875 1528.7639,490.57681 1532.8494,486.53074 C 1534.4878,485.10339 1536.2977,487.54639 1537.6299,488.41537 C 1541.6915,492.13268 1545.4763,496.30202 1548.1172,501.16357 C 1550.7719,506.75982 1553.4209,512.451 1554.7993,518.5184 C 1555.4331,520.6703 1554.6753,523.06785 1552.7866,524.33238 C 1549.8641,526.78907 1545.9926,528.39458 1542.1374,527.59444 C 1540.8652,527.39234 1539.6189,527.05265 1538.395,526.65576 z\" />\n");
				pw.write("<path id=\"NU8\" d=\"M 1909.7461,677.41272 C 1895.1773,676.96937 1880.5105,676.77632 1869.0758,667.36145 C 1858.6276,668.07642 1834.2853,661.50452 1840.4243,648.9636 C 1832.815,642.69748 1820.5235,634.22917 1810.6262,628.33723 C 1800.3622,628.56519 1789.3244,632.12785 1781.8323,640 C 1772.323,639.71998 1757.4223,642.46202 1755.93,629.36419 C 1755.1952,617.56435 1761.4441,601.13187 1776.3706,605.06438 C 1786.899,605.77971 1815.2983,597.2827 1798.8808,585.53982 C 1789.0509,576.74532 1803.6088,563.6045 1806.7609,553.66047 C 1811.8589,546.56453 1804.6538,537.70178 1801.925,531.03835 C 1794.1186,519.61355 1782.0869,508.97133 1773.458,500.84247 C 1767.2022,505.65662 1750.068,511.15405 1761.3383,497.77614 C 1769.8932,486.17601 1740.5242,501.05414 1751.0312,487.39928 C 1750.8842,481.07164 1731.6193,463.15182 1732.0917,478.02081 C 1721.2677,478.61943 1710.1748,477.66396 1699.5655,479.01376 C 1689.346,485.14181 1672.7565,478.42725 1660.135,480.39087 C 1648.3396,483.18647 1647.1384,465.47446 1633.4108,472.3487 C 1620.6971,469.88066 1608.0599,445.0059 1630.3539,450 C 1639.0925,444.1442 1609.8357,449.05159 1613.7199,437.11579 C 1609.8978,412.95784 1617.1437,388.03149 1628.9433,367.01378 C 1632.973,353.87725 1667.7509,354.14192 1657.5164,370.11358 C 1648.7927,383.31378 1644.9013,400.61383 1650.3545,415.68748 C 1666.2998,410.58626 1644.3145,390.14669 1659.9686,382 C 1662.5941,368.81544 1680.4806,352.57827 1692.9198,363.35666 C 1705.3096,372.7153 1699.8071,405.60804 1720.2531,396.70585 C 1722.202,380.44783 1746.5512,382.78675 1755.202,392.52337 C 1762.5191,401.12126 1767.7546,414.37469 1778.5958,418.27238 C 1787.3708,397.69645 1801.7715,426.14688 1810.4037,432.99864 C 1821.3066,425.54257 1833.2947,437.56753 1829.1258,447.78978 C 1841.1978,432.27532 1848.7602,457.92454 1853.4548,465.27706 C 1868.3374,472.17976 1851.1624,478.68247 1845.7191,477.81136 C 1848.8282,486.4524 1843.9196,497.31625 1857.7314,498.43561 C 1866.8688,505.44696 1879.4407,504.74894 1889.7224,505.48336 C 1894.8435,516.51164 1910.3359,512.55593 1912.419,523.75232 C 1919.9553,523.35092 1928.2297,515.66778 1933.9813,524.34746 C 1935.1543,538.20248 1930.4473,548.09724 1930.1804,561.87905 C 1913.0284,564.8475 1941.7766,584.5554 1920.3278,584.03169 C 1903.7583,581.64947 1898.181,564.887 1884.1947,558.30517 C 1875.8423,550.66357 1865.0034,559.61673 1874.8616,567.37638 C 1863.8964,577.71555 1885.1218,578.6092 1888.5463,588.83884 C 1903.14,592.16778 1911.5373,602.10466 1920.0651,613.96658 C 1923.1487,619.0494 1931.6915,621.85101 1929.982,628.80232 C 1928.3526,635.98951 1933.7825,652.22528 1925.3098,651.96536 C 1910.7465,648.11203 1896.5408,642.49231 1883.7567,634.70981 C 1865.8188,632.87671 1892.0072,650.20393 1898.9638,651.51928 C 1907.0231,655.53384 1914.4335,660.66338 1922.0044,665.5 C 1920.7591,669.9786 1924.5571,679.60371 1916.9583,677.59876 C 1914.555,677.62941 1912.1326,677.77781 1909.7461,677.41272 z\" />\n");
				pw.write("<path id=\"NU9\" d=\"M 1764.2551,673.68787 C 1762.8086,672.68924 1761.357,671.52123 1760.5951,669.8943 C 1760.0821,668.84253 1760.1746,667.51617 1760.924,666.5982 C 1761.5835,665.69551 1762.6407,664.98564 1763.7995,665.09091 C 1765.3451,665.22414 1766.6858,666.10784 1767.9362,666.95551 C 1769.5195,668.02709 1770.8532,669.71016 1770.9853,671.67662 C 1771.084,672.929 1770.533,674.18168 1769.5934,675.00484 C 1769.1426,675.46789 1768.5404,675.99651 1767.8408,675.78372 C 1766.8004,675.46469 1765.9292,674.77469 1765.0196,674.2015 C 1764.7643,674.03097 1764.5096,673.85942 1764.2551,673.68787 z\" />\n");
				pw.write("<path id=\"NU10\" d=\"M 1775.191,662.28656 C 1774.4984,662.14982 1773.675,661.94645 1773.3346,661.25502 C 1773.0048,660.51388 1773.137,659.6754 1773.2271,658.89614 C 1773.3398,658.05346 1773.632,657.11806 1774.4201,656.67333 C 1775.2105,656.24106 1776.1456,656.13974 1777.0334,656.17891 C 1778.8149,656.31964 1780.5419,657.17783 1781.7184,658.52484 C 1782.3358,659.24239 1782.8073,660.25489 1782.4744,661.20368 C 1782.2426,661.94682 1781.5914,662.50814 1780.8346,662.66729 C 1779.5584,662.95819 1778.2357,662.7612 1776.9569,662.59094 C 1776.3661,662.50262 1775.7776,662.39847 1775.191,662.28656 z\" />\n");
				pw.write("<path id=\"NU11\" d=\"M 1759.0087,551.1626 C 1756.0824,548.07523 1755.29,543.62745 1755.0557,539.52899 C 1754.8669,533.53366 1755.9173,527.30444 1759.0457,522.11011 C 1760.591,519.56102 1763.1359,517.25984 1766.2759,517.2419 C 1770.6638,517.09486 1774.6001,519.97705 1776.9,523.53344 C 1778.1718,525.99925 1777.8673,528.87833 1777.9885,531.56199 C 1777.9413,535.97894 1778.2109,540.4313 1777.5696,544.81688 C 1777.2828,547.07862 1775.9489,549.14872 1773.9422,550.25526 C 1771.3918,551.67144 1768.7475,553.05513 1765.8887,553.72547 C 1763.4483,554.36972 1760.9864,553.20112 1759.3117,551.45911 L 1759.1608,551.31303 L 1759.0087,551.16258 L 1759.0087,551.1626 z\" />\n");
				pw.write("<path id=\"NU12\" d=\"M 1786.5,532.80859 C 1784.7234,531.94098 1783.2541,530.46775 1782.3279,528.7266 C 1781.9308,527.91702 1781.5609,526.92497 1781.9719,526.05125 C 1782.4217,525.30493 1783.3566,525.10267 1784.1498,524.94103 C 1786.2205,524.62039 1788.3632,524.80336 1790.3738,525.37803 C 1791.375,525.68955 1792.446,526.13317 1793.0047,527.07844 C 1793.5987,527.93792 1794.1712,529.02295 1793.796,530.0838 C 1793.3575,531.19263 1792.2519,531.81664 1791.25,532.34748 C 1789.9326,533.03148 1788.3435,533.50465 1786.8897,532.96901 C 1786.7573,532.922 1786.6272,532.86828 1786.5,532.80859 z\" />\n");
				pw.write("<path id=\"NU13\" d=\"M 1726.6667,506.33334 C 1725.8331,505.72667 1726.0259,504.58991 1726.6447,503.90123 C 1727.6543,502.43485 1729.0414,501.23078 1729.7637,499.57251 C 1730.8106,497.47489 1731.2738,495.15539 1731.5821,492.8493 C 1732.0975,490.16642 1732.9008,487.46874 1734.4403,485.18406 C 1734.8938,484.5581 1735.6683,483.66844 1736.5197,484.14011 C 1737.4888,484.86622 1737.529,486.24608 1737.4243,487.35477 C 1737.3435,488.64298 1736.484,489.68119 1736.2393,490.92483 C 1735.8307,492.43618 1735.813,494.00697 1735.8563,495.55892 C 1735.6221,498.5231 1734.1575,501.25592 1732.3719,503.57663 C 1731.2809,504.89055 1730.0336,506.26549 1728.3369,506.74968 C 1727.753,506.89767 1727.0924,506.7834 1726.6667,506.33334 z\" />\n");
				pw.write("<path id=\"NU14\" d=\"M 1522.3143,434.94797 C 1519.7071,432.78636 1516.8545,430.1673 1517.2098,426.46459 C 1516.8481,421.46844 1514.9987,416.37661 1510.8659,413.28014 C 1507.7734,410.66369 1504.0018,408.763 1501.88,405.14737 C 1499.886,401.90772 1497.3661,398.57996 1496.9439,394.70502 C 1497.602,390.53575 1499.2704,385.86535 1503.1517,383.67737 C 1506.6298,383.40223 1508.9767,387.10498 1511.8546,388.65934 C 1515.01,392.30473 1517.9364,387.76983 1518.7442,384.70019 C 1520.7077,381.20066 1518.9921,377.71078 1516.1943,375.33157 C 1513.2544,372.07004 1512.1011,367.39906 1513.4913,363.19614 C 1514.5375,359.79394 1515.841,355.71521 1519.2622,354.05517 C 1522.7051,354.37946 1525.6284,356.70883 1528.6832,358.20896 C 1532.1348,361.20661 1534.3933,356.27382 1537.8123,355.87744 C 1541.2868,354.9531 1545.3023,353.63806 1548.75,355.21753 C 1550.4339,358.3955 1550.1532,362.35523 1549.6348,365.82773 C 1549.5239,367.67092 1545.1129,367.86538 1548.25,369.43166 C 1552.1054,371.97072 1547.2272,375.72339 1545.5,378 C 1543.9762,380.21743 1538.3245,384.45159 1543.3974,385.91897 C 1548.4406,386.60469 1546.2677,392.46114 1548.7444,395.47639 C 1552.4791,401.2784 1552.8075,408.39241 1552.7728,415.08074 C 1552.1636,420.58673 1547.7981,424.91505 1543.2958,427.7145 C 1541.1206,429.22603 1537.7399,428.28083 1538.1536,431.64073 C 1535.7221,435.16535 1531.7129,438.36401 1527.2364,438.20296 C 1525.311,437.67745 1523.8581,436.13011 1522.3143,434.94797 z\" />\n");
				pw.write("<path id=\"NU15\" d=\"M 1563.6349,415.92743 C 1560.9133,414.26919 1560.9258,410.87901 1560.9534,408.07647 C 1560.9308,404.21584 1559.0129,400.70511 1559.0324,396.83945 C 1558.6607,387.33854 1559.4984,377.72683 1561.8516,368.50365 C 1563.2047,364.32214 1565.2149,360.32469 1565.8222,355.92222 C 1566.464,351.95799 1570.5512,350.15105 1574.0765,349.48334 C 1578.7266,348.60257 1583.85,347.17276 1588.2779,349.64003 C 1590.9488,351.09478 1593.8685,352.04276 1596.9007,352.25862 C 1601.7939,353.60301 1606.4378,356.13884 1610.1006,359.65375 C 1610.8241,362.58381 1608.0377,365.27114 1606.6544,367.73514 C 1604.2749,370.41392 1604.4968,374.30824 1602.4838,377.21713 C 1599.9844,381.27427 1597.4506,385.3974 1596.2197,390.05472 C 1595.1282,392.61434 1595.6095,397.74719 1591.87,397.80365 C 1587.5667,398.50231 1583.017,398.20784 1578.8961,399.72999 C 1577.5263,404.03335 1577.4752,408.66273 1577.0871,413.14048 C 1576.7443,415.94533 1573.2113,416.79562 1570.932,417.65581 C 1568.3688,418.57685 1565.6953,417.4545 1563.6349,415.92743 z\" />\n");
				pw.write("<path id=\"NU16\" d=\"M 1708.1644,382.75 C 1704.3854,376.4069 1701.0852,369.76911 1698.3113,362.92654 C 1697.6958,361.43179 1696.4278,358.71857 1699.0592,358.58747 C 1703.9867,357.63981 1709.0562,357.84272 1714.0397,358.14575 C 1717.0219,358.46514 1720.1639,358.57831 1722.892,359.9425 C 1728.5727,363.34171 1733.2499,368.25404 1737.0162,373.65616 C 1738.001,375.41014 1739.7328,377.18623 1739.3566,379.34778 C 1738.6436,381.29257 1736.2515,381.58326 1734.4562,381.81278 C 1730.2456,382.17472 1725.8161,381.25493 1721.8149,383.03031 C 1718.7386,384.38922 1715.5798,386.50073 1712.0543,385.86327 C 1710.3418,385.51405 1709.0363,384.19925 1708.1644,382.75 z\" />\n");
				pw.write("<path id=\"NU17\" d=\"M 1608.5,335.47391 C 1604.3424,331.73096 1595.2984,335.03481 1594.7998,327.60109 C 1595.0212,320.67131 1591.7674,314.43387 1591.5437,307.59823 C 1591.378,301.31636 1594.8131,295.24556 1593.0969,288.8787 C 1589.5032,284.82449 1589.0997,276.35443 1582.1679,277.08629 C 1576.6788,276.4145 1569.9083,277.17185 1566.7108,271.59295 C 1563.7262,267.46702 1559.1117,263.6603 1558.5879,258.36218 C 1557.6082,251.33688 1564.8303,248.45335 1570.6656,250.39051 C 1577.0089,250.92814 1584.1891,253.87528 1585.8432,260.67036 C 1590.7481,265.48418 1598.5431,260.41729 1604.2258,263.70952 C 1608.227,266.55284 1606.1599,272.94147 1611.8689,274.41546 C 1616.932,279.06057 1608.0325,286.28969 1614.6601,290.01526 C 1618.2758,293.45161 1617.8657,299.89892 1624.5709,298.74544 C 1630.9023,299.81691 1637.1966,301.09079 1643.5,302.31259 C 1648.145,299.95513 1653.0283,298.03773 1657.7473,295.95767 C 1662.2118,291.54654 1667.8742,288.86364 1674.2607,290.11747 C 1681.4221,289.82789 1688.3714,292.24236 1694.0055,296.62341 C 1698.1821,299.90659 1703.5761,304.3222 1702.8557,310.20757 C 1699.7546,314.18377 1705.2173,319.27087 1700.5287,322.99935 C 1700.6585,329.32526 1695.1749,332.53734 1689.6333,333.79783 C 1684.211,335.04734 1677.5286,336.28286 1672.8122,332.58441 C 1670.1419,327.45011 1664.9299,336.45964 1660.3573,336.09946 C 1650.9983,337.66985 1641.3952,337.4287 1631.9333,337.2356 C 1627.0751,337.97576 1623.9834,334.28082 1621.8956,331.20641 C 1617.1706,334.0015 1614.5205,341.36496 1608.5,335.47391 z\" />\n");
				pw.write("<path id=\"NU18\" d=\"M 1574.5,332.27509 C 1571.6224,331.08447 1569.0935,329.1968 1566.4989,327.4968 C 1563.6959,325.52019 1560.8153,323.59989 1558.3526,321.19876 C 1556.5209,319.3327 1557.0764,316.49018 1557.911,314.29708 C 1559.4438,310.39143 1561.4451,306.67139 1563.6585,303.11198 C 1564.8623,301.10121 1566.8213,299.61919 1569.0965,299.04151 C 1573.48,297.6073 1578.3448,299.04867 1581.8245,301.90959 C 1583.3396,302.96379 1584.5584,304.50362 1584.7751,306.38658 C 1585.4924,311.0227 1585.5367,315.73118 1585.8511,320.40539 C 1585.8899,322.94959 1586.3208,325.59636 1585.5163,328.0628 C 1584.6605,329.7351 1583.1648,331.0542 1581.5826,332.03068 C 1579.4053,333.2438 1576.8062,332.83881 1574.5,332.27509 z\" />\n");
				pw.write("<path id=\"NU19\" d=\"M 1535.3401,313.91721 C 1531.5886,312.00776 1527.9846,309.15673 1526.2143,305.24711 C 1525.4672,302.76626 1527.9968,300.88395 1529.5495,299.33078 C 1530.5017,298.49516 1531.454,297.65954 1532.4062,296.82391 C 1526.9975,296.91473 1521.5797,297.41279 1516.1755,297.03136 C 1513.5364,297.07518 1510.9741,295.18203 1511.0879,292.37237 C 1510.9854,289.35229 1511.1967,285.83201 1508.7354,283.59751 C 1505.89,280.6892 1501.8067,279.32771 1499,276.41354 C 1500.0731,274.29375 1500.8633,271.03084 1503.513,270.45772 C 1506.8805,270.52729 1510.3792,270.93784 1513.4701,272.3582 C 1515.6127,273.97817 1515.8158,277.17638 1518.1538,278.87564 C 1520.5338,281.30819 1522.8757,284.48851 1526.4719,284.98559 C 1529.7977,285.84085 1530.5168,282.16701 1530.2731,279.67192 C 1530.0676,275.56561 1525.9054,273.65431 1522.9346,271.66462 C 1519.032,269.78407 1522.7368,266.70791 1524.74,265.1301 C 1527.3785,263.12374 1530.1412,260.24005 1533.731,260.56799 C 1539.1082,261.48976 1544.9271,261.00562 1549.8647,263.64703 C 1550.5825,264.222 1551.6561,264.6115 1552.1519,265.30214 C 1551.7214,276.81116 1551.7278,288.34774 1550.6773,299.82386 C 1550.7722,302.54264 1548.833,304.83215 1549.4164,307.56694 C 1549.9252,310.17469 1550.4278,313.87708 1547.5122,315.2851 C 1543.578,316.78696 1539.0796,315.34975 1535.3401,313.91721 z\" />\n");
				pw.write("<path id=\"NU20\" d=\"M 1462.6174,307.55176 C 1460.0173,305.79033 1456.2278,304.62545 1453.5943,306.99188 C 1451.8817,309.32782 1448.83,308.24357 1450.1149,305.26049 C 1451.041,298.74872 1452.4847,292.25304 1454.8463,286.10432 C 1456.6774,284.36344 1457.2932,282.03918 1457.0034,279.33325 C 1457.5852,270.77484 1459.3512,262.34008 1461.2255,253.98353 C 1462.0888,251.13073 1462.3511,247.8955 1464.2184,245.47875 C 1466.8648,242.54111 1472.903,244.86766 1472.3122,248.95773 C 1470.4215,251.74418 1472.0828,254.62018 1472.3527,257.55486 C 1472.5747,260.81016 1471.9862,264.07244 1470.7664,267.07882 C 1470.4391,269.73478 1469.8172,272.83637 1471.2274,275.24145 C 1473.8525,276.62159 1476.993,275.47454 1479.7191,274.93867 C 1481.9613,274.12611 1484.9127,273.55952 1486.3964,275.98935 C 1489.0901,279.94076 1489.4044,284.99005 1489.385,289.63524 C 1489.2818,292.88099 1488.7146,296.30622 1486.4827,298.81974 C 1484.1306,302.29381 1482.0119,306.25913 1478.0654,308.17698 C 1473.2755,310.8077 1467.206,310.45174 1462.6174,307.55176 z\" />\n");
				pw.write("<path id=\"NU21\" d=\"M 1489.9622,307.40051 C 1489.4865,306.25418 1489.389,304.92638 1489.8885,303.77008 C 1490.4529,302.40928 1491.3639,301.23298 1492.0912,299.95963 C 1492.3043,299.33131 1492.8364,299.0651 1493.4677,298.99972 C 1494.7824,298.72842 1496.1005,298.40382 1497.4459,298.34647 C 1498.2466,298.29963 1498.9666,298.79379 1499.3686,299.4607 C 1500.185,300.75287 1500.7556,302.18114 1501.357,303.58142 C 1501.8388,304.85843 1502.3587,306.17876 1502.3584,307.56347 C 1502.4314,308.24681 1501.7768,308.56938 1501.2188,308.70621 C 1498.7456,309.42154 1496.153,309.57994 1493.5922,309.66434 C 1492.6044,309.65706 1491.4077,309.69706 1490.7116,308.86387 C 1490.3604,308.43638 1490.1614,307.90981 1489.9622,307.40051 z\" />\n");
				pw.write("<path id=\"NU22\" d=\"M 1684.5028,276.00894 C 1685.9644,268.07528 1675.9812,265.9347 1671.8524,271.71199 C 1664.6077,273.05662 1656.3263,258.09769 1655.4397,272.1706 C 1645.7012,276.99943 1632.4378,272.55259 1621.331,272.86699 C 1609.3518,267.6388 1616.0368,249.10418 1626.279,245.24192 C 1639.3842,243.09329 1615.7156,231.84481 1624.1497,223.68426 C 1632.8473,213.46252 1645.1052,224.90482 1647.5756,234.66649 C 1657.9815,239.83734 1648.0116,227.68672 1644.7607,224.3497 C 1638.1595,220.09558 1653.6346,211.58377 1644.3348,213 C 1633.8662,215.80062 1625.0239,206.9637 1632.8316,197.24616 C 1632.5275,189.12582 1641.1444,185.60132 1647.5263,182.34636 C 1652.3535,180.96186 1657.1085,187.18758 1661.9556,188.23181 C 1666.3792,188.59588 1664.9894,179.43273 1658.9483,182.08811 C 1648.1134,176.59985 1647.5323,163.12373 1639.9823,154.77136 C 1632.2359,149.78377 1630.8574,135.02353 1638.3623,129.51928 C 1651.5953,127.13983 1656.8434,141.25669 1664.521,148.81234 C 1665.4736,140.44672 1647.8477,130.42547 1662.3673,125.4641 C 1671.5725,121.62279 1676.8346,116.55627 1682.3088,108.73693 C 1686.1275,107.19064 1677.4401,94.58526 1676.651,102 C 1672.7973,111.74531 1664.4814,120.45583 1653.1884,119.04307 C 1644.7599,122.77968 1631.0634,120.90992 1637.3945,108.59833 C 1638.5305,98.52932 1631.2913,123.22116 1623.6579,115.14031 C 1616.5726,114.36851 1617.4364,105.96685 1616.1224,104 C 1604.3482,102.77254 1612.9285,89.420521 1617.7144,85.247108 C 1611.4703,82.244667 1596.7489,78.931253 1607.381,70.553908 C 1615.7706,66.926311 1621.7435,58.13784 1630.8434,57.919652 C 1631.3342,50.192057 1639.5087,37.888848 1648.2847,46.418486 C 1655.8054,51.437715 1652.7662,35.06126 1658.9719,32.570609 C 1661.2203,20.949957 1673.1138,21.310349 1678.9627,13.823929 C 1690.6015,16.64317 1700.6341,9.3199834 1712.0433,9.7516968 C 1722.2665,9.8896453 1732.6366,7.9569087 1743.2815,9.303146 C 1748.4803,13.878406 1753.5033,18.648866 1760.7774,20.497148 C 1766.4041,30.780325 1764.2192,45.380548 1756.8579,54.25 C 1748.8377,57.535619 1741.4191,68.040202 1740.8035,74.598605 C 1745.5051,70.495491 1756.1783,52.76046 1759.0931,66.368652 C 1759.6314,78.305055 1749.4767,87.117846 1747.7505,98.777697 C 1742.2635,110.43178 1737.1165,122.44347 1736.4346,135.49362 C 1736.2802,147.14693 1721.1372,141.26674 1720.9095,152.32726 C 1716.5977,158.85369 1698.43,157.74469 1708.9425,167.64557 C 1707.2627,172.64063 1704.6881,175.45936 1712.3488,174.84769 C 1722.0392,177.77173 1720.5516,189.4042 1716.7785,194.63247 C 1726.3638,200.50125 1713.6129,203.72391 1714.3491,211.37044 C 1712.049,217.96748 1700.6607,213.25971 1703.7276,221.51747 C 1709.191,231.34459 1692.9304,236.8398 1698.4853,244.61638 C 1712.5406,249.71022 1707.0077,266.44598 1697.2147,273.26096 C 1694.2457,275.36205 1687.3021,281.03066 1684.5028,276.00894 z\" />\n");
				pw.write("<path id=\"NU23\" d=\"M 1497.4933,238.58421 C 1495.6458,236.78026 1494.8905,234.11581 1495.0017,231.58496 C 1495.0956,229.32168 1495.6553,227.08015 1496.5597,225.00716 C 1496.9596,224.18249 1497.5681,223.16385 1498.602,223.14367 C 1499.7261,223.21627 1500.5233,224.15358 1501.2107,224.95028 C 1503.4035,227.68842 1504.9369,231.12844 1504.8413,234.68672 C 1504.7879,236.66425 1504.006,238.78805 1502.2471,239.8569 C 1501.4486,240.36185 1500.3997,240.74984 1499.5098,240.23057 C 1498.7368,239.82129 1498.1133,239.18894 1497.4933,238.58421 z\" />\n");
				pw.write("<path id=\"NU24\" d=\"M 1571.1178,237.21732 C 1569.0216,236.08217 1566.7799,234.8217 1565.5692,232.67888 C 1564.6564,231.08909 1565.1838,229.12501 1566.2281,227.7395 C 1568.4526,224.74921 1571.7817,222.35225 1575.5747,222.00567 C 1579.4009,221.63722 1583.2406,223.29015 1585.9759,225.91209 C 1587.4363,227.30709 1588.2842,229.47018 1587.616,231.45299 C 1586.8507,233.82431 1584.9724,235.64728 1583.0233,237.10097 C 1579.9766,239.23483 1575.8755,239.26514 1572.5222,237.86231 C 1572.0438,237.67072 1571.5752,237.45464 1571.1178,237.21732 z\" />\n");
				pw.write("<path id=\"NU25\" d=\"M 1562.3455,220.54926 C 1559.8033,219.55548 1557.691,216.9121 1558.2228,214.07634 C 1558.8269,212.66007 1558.2384,211.15905 1557.4371,209.95788 C 1555.7767,207.49139 1553.3889,205.42184 1552.5456,202.47179 C 1551.7066,199.57053 1552.0461,196.47156 1552.5617,193.54448 C 1553.15,190.94399 1554.6425,188.00393 1557.5061,187.44454 C 1559.7324,187.13004 1561.5875,188.7039 1563.4575,189.64354 C 1566.9456,191.63504 1570.146,194.10994 1573.738,195.92036 C 1575.2587,196.15784 1575.5752,197.96465 1575.9943,199.19334 C 1577.3591,204.32239 1576.9235,209.66111 1577,214.90839 C 1574.312,216.91252 1571.7261,219.06158 1568.9284,220.91246 C 1567.4932,221.96976 1565.5814,222.00221 1564.0076,221.24214 C 1563.4472,221.02682 1562.8959,220.78821 1562.3455,220.54926 z\" />\n");
				pw.write("<path id=\"NU26\" d=\"M 1540.704,218.67632 C 1536.3688,214.34436 1532.9279,209.00754 1527.7216,205.62798 C 1524.2688,203.34433 1520.0414,203.98067 1516.1434,203.89209 C 1512.8844,203.76403 1510.5034,200.98575 1508.929,198.40001 C 1507.2971,195.44257 1507.8103,190.94516 1510.8847,189.15262 C 1513.2916,188.77775 1515.9548,187.01909 1516.3803,184.47767 C 1516.2717,180.26335 1513.7699,176.48187 1510.5547,173.90904 C 1507.7244,171.32529 1506.7348,166.45997 1509.5635,163.49757 C 1512.8576,160.00542 1518.5723,160.50474 1522.2584,163.09719 C 1524.1789,164.34763 1526.1558,166.22757 1526.0665,168.70476 C 1526.5466,171.43383 1529.7139,171.32101 1531.6075,172.42941 C 1535.6636,175.05131 1538.349,179.19645 1540.5852,183.37135 C 1542.0286,186.32392 1545.1208,188.21751 1546.049,191.43716 C 1547.0107,195.74966 1542.8168,199.73191 1544.6103,204.0044 C 1546.059,206.99429 1549.2238,208.99543 1550,212.33496 C 1549.8212,215.96974 1547.2602,219.91013 1543.459,220.44257 C 1542.2797,220.42649 1541.472,219.43303 1540.704,218.67632 z\" />\n");
				pw.write("<path id=\"NU27\" d=\"M 1598.0897,207.85326 C 1594.4186,204.66196 1593.0377,199.84454 1589.6436,196.44944 C 1586.3604,192.0352 1583.1868,186.88459 1583.0448,181.24614 C 1583.5945,175.64067 1589.3573,174.0019 1593.8569,172.99521 C 1598.6777,170.99637 1596.3922,166.75509 1592.2095,166.06566 C 1587.1095,164.79622 1581.6541,168.36868 1576.588,166.13109 C 1571.7476,164.10564 1575.0571,158.96895 1575.0319,156 C 1569.6889,154.29391 1569.2204,147.59452 1570.8024,143.0632 C 1570.4274,136.85385 1578.6484,140.94439 1579.6209,137.44554 C 1578.8622,132.73099 1571.3383,130.95183 1573.6148,125.56266 C 1574.049,119.06712 1582.9902,121.73316 1584.723,117.80457 C 1582.9984,114.7999 1580.247,112.55486 1577.9752,109.96902 C 1579.9257,105.91486 1582.1164,101.62103 1586.4027,99.614628 C 1589.2419,96.762394 1586.9942,89.389494 1593.4904,91.23863 C 1599.0925,91.905079 1603.6621,96.061039 1605.2069,101.4339 C 1607.7328,106.15735 1608.0496,111.76174 1611.6068,115.95704 C 1614.3163,120.65628 1619.5664,123.75657 1620.9439,129.1679 C 1620.7886,137.07575 1631.5387,139.90222 1631,147.92355 C 1630.3721,153.35971 1635.8851,156.25743 1639.266,159.4551 C 1643.7898,162.01946 1646.4018,167.16744 1644.4654,172.21064 C 1641.4316,178.45869 1636.771,183.8519 1631.9805,188.83572 C 1627.2488,190.71723 1628.2938,196.18728 1625.3932,199.58864 C 1623.0454,203.61601 1619.19,208.05391 1614.1627,205.33386 C 1612.075,207.32871 1613.3062,213.04201 1608.2234,211.74615 C 1604.1323,212.53947 1600.5678,211.26361 1598.0897,207.85326 z\" />\n");
				pw.write("<path id=\"NU28\" d=\"M 1474.3076,192 C 1474.8132,189.70607 1475.2285,187.39358 1475.6773,185.08842 C 1475.9146,184.12458 1476.1658,183.12772 1476.7298,182.2959 C 1477.0001,181.74717 1477.6114,182.11509 1477.6035,182.61791 C 1477.8121,183.79119 1477.6525,184.99129 1477.5063,186.16288 C 1477.221,188.05504 1476.8137,189.94752 1476.071,191.7176 C 1475.815,192.33326 1475.4574,192.91474 1474.9338,193.33848 C 1474.7111,193.54545 1474.0707,194.21401 1474.0352,193.57797 C 1474.0607,193.04387 1474.1999,192.52157 1474.3076,192 z\" />\n");
				pw.write("<path id=\"NU29\" d=\"M 1549.9764,148.7182 C 1547.8996,147.02177 1546.0903,144.89746 1545.0842,142.38929 C 1544.6978,141.40475 1544.4971,140.28866 1544.8638,139.26694 C 1545.2756,137.72807 1546.0321,136.04736 1547.6027,135.40376 C 1548.7872,134.94733 1550.1399,134.85778 1551.3659,135.20093 C 1553.0328,135.75421 1554.0777,137.29475 1555.0404,138.66564 C 1556.0758,140.28411 1557.236,141.89022 1557.7502,143.76699 C 1558.0879,144.93683 1557.642,146.17674 1556.8579,147.06224 C 1555.8918,148.16107 1554.8296,149.31663 1553.3987,149.77866 C 1552.1523,150.1643 1550.9168,149.48646 1549.9764,148.7182 z\" />\n");
				pw.write("</g>\n");
				pw.write("</g>\n");
				pw.write("</g>\n");
				pw.write("</svg>");
				
				pw.close();
				
				
				
				// Create a PNG transcoder
				PNGTranscoder t = new PNGTranscoder();
		       
		       	// Create the transcoder input.
		        TranscoderInput input = new TranscoderInput(file.toURI().toString());
	
		        // Create the transcoder output.
		        OutputStream ostream = new FileOutputStream(InstallationConfig.getInstance().get(InstallationConfig.GENERATED_IMAGES_DIR_KEY) + ApplicationConfig.SVG_FILE_PREFIX + taxon.getId() + ApplicationConfig.PNG_FILE_EXT);
		        TranscoderOutput output = new TranscoderOutput(ostream);
	
		        // Save the image.
		        try {
					t.transcode(input, output);
			        // Flush and close the stream.
			        ostream.flush();
			        ostream.close();
		        }
				catch (TranscoderException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} 
		        catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();		
				}
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		//}
	}
	
	private static String getDistributionColor(String distribution){
		String color = "";
		if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_ABSENT;
		}
		else if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_INTRODUCED)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_INTRODUCED;
		}
		else if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_NATIVE)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_NATIVE;
		}
		else if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_EXTIRPATED)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_EXTIRPATED;
		}
		else if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_EXCLUDED)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_EXCLUDED;
		}
		else if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_DOUBTFUL)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_DOUBTFUL;
		}
		else if(distribution.equals(ApplicationConfig.LABEL_DISTRIBUTION_EPHEMERAL)){
			color = ApplicationConfig.COLOR_DISTRIBUTION_EPHEMERAL;
		}
		else{
			color = ApplicationConfig.COLOR_DISTRIBUTION_DEFAULT;
		}
			
		return color;
	}
	
	public static Vector<HashMap<String,Object>> computeDistribution(Lookup lookup){
		Vector<HashMap<String,Object>> taxonDistributions = new Vector<HashMap<String,Object>>();
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
	    HashMap<String,Object> distributionData = null;
	    Region province;
	    if(!lookup.getAB().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_AB);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getAB());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getBC().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_BC);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getBC());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getGL().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_GL);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getGL());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getMB().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_MB);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getMB());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getNB().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_NB);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getNB());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getNL_L().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_NLL);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getNL_L());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getNL_N().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_NLN);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getNL_N());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getNS().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_NS);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getNS());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getNT().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_NT);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getNT());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getNU().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_NU);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getNU());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getON().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_ON);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getON());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getPE().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_PE);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getPE());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getPM().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_PM);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getPM());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getQC().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_QC);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getQC());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getSK().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_SK);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getSK());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    
	    if(!lookup.getYT().equals(ApplicationConfig.LABEL_DISTRIBUTION_ABSENT)){
	        distributionData = new HashMap<String,Object>();
	        province = (Region)hibernateSession.load(Region.class,ApplicationConfig.PROVINCE_YT);
	        distributionData.put("province",province.getRegion());
	        distributionData.put("exluded","");
	        distributionData.put("status",lookup.getYT());
	        distributionData.put("reference","");
	        distributionData.put("referenceShort","");
	        distributionData.put("link","");
	        taxonDistributions.add(distributionData);
	    }
	    return taxonDistributions;
	}

	public static final List<Taxon> findByName(String name){
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		//Query query = hibernateSession.createQuery("FROM Taxon taxon  INNER JOIN taxon.lookup Lookup WHERE Lookup.calname = :name");		
		Criteria taxonCriteria = hibernateSession.createCriteria(Taxon.class).createCriteria("lookup").add(Restrictions.like("calname", name));		
		List<Taxon> results = (List<Taxon>) taxonCriteria.list();
		return results;
	}

	public static final List<Taxon> findByVernacularName(String name){
		org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		//Query query = hibernateSession.createQuery("FROM Taxon taxon  INNER JOIN taxon.lookup Lookup WHERE Lookup.calname = :name");		
		Criteria taxonCriteria = hibernateSession.createCriteria(Taxon.class).createCriteria("vernacularnames").add(Restrictions.like("name", name));		
		List<Taxon> results = (List<Taxon>) taxonCriteria.list();
		return results;
	}
	
	/**
	 * Get all parent taxon names.
	 * @param taxonId
	 * @param taxonRank this taxon rank
	 * @param higherClassification results Map with TaxonRankEnum as key and calname as value
	 */
	private static void getHigherClassificationNames(int taxonId, TaxonRankEnum taxonRank, TreeMap<TaxonRankEnum,String> higherClassification){
		String parentRankName;
		higherClassification.clear();
		for(TaxonRankEnum currTaxonEnum:TaxonRankEnum.getOrderedRanks()){
			//check if the current rank is a higher rank
			if(currTaxonEnum.getOrder()<taxonRank.getOrder()){
				parentRankName = getParentFSNByRankId(taxonId,ApplicationConfig.getRankIdFromEnum(currTaxonEnum));
				if(StringUtils.isNotBlank(parentRankName)){
					higherClassification.put(currTaxonEnum,parentRankName);
				}
			}
			else{
				break;
			}
			
		}
	}
	
	/**
	 * This function fills a ScientificNameStructure from the database.
	 * @param taxonId
	 * @return the filled ScientificNameStructure or an empty ScientificNameStructure id the taxonId was
	 * not found.
	 */
	public static ScientificNameStructure loadScientificNameStructure(int taxonId){
		ScientificNameStructure scientificNameStructure = new ScientificNameStructure();
		Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
		
		Query query = hibernateSession.createSQLQuery("SELECT uninomial,binomial,trinomial,quadrinomial,rankid,author FROM taxon WHERE taxon.id =:id")
		.addScalar("uninomial",Hibernate.STRING)
		.addScalar("binomial",Hibernate.STRING)
		.addScalar("trinomial",Hibernate.STRING)
		.addScalar("quadrinomial",Hibernate.STRING)
		.addScalar("rankid",Hibernate.INTEGER)
		.addScalar("author",Hibernate.STRING);
		query.setParameter("id", taxonId);
		
		List<Object[]> taxon = query.list();
		for(Object[] t : taxon){
			scientificNameStructure.setUninomial((String)t[0]);
			scientificNameStructure.setBinomial((String)t[1]);
			scientificNameStructure.setTrinomial((String)t[2]);
			scientificNameStructure.setQuadrinomial((String)t[3]);
			scientificNameStructure.setRankId((Integer)t[4]);
			scientificNameStructure.setRank(LabelMappings.getRankLabel((Integer)t[4]));
			scientificNameStructure.setRankEnum(ApplicationConfig.getRankAsEnum((Integer)t[4]));
			scientificNameStructure.setAuthor((String)t[5]);
		}
		return scientificNameStructure;
	}
}